473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Determine If A Child Form Has Been Closed?

Hi,

I need to either determine that a child form has been closed or
disable the close box without removing the entire control box.

Is there an easy way to determine if a child form has been closed?
This is modeless, not MDI. I haven't found a already defined event
for this non-MDI case. The form instance still resides in the parent
form. Is there something in it that can be checked?

What I have is:

if (CRT == null)
{
CType30CRT Display = new CType30CRT();
CRT.Show(this);
}

Also, there does not appear to be a means to disable the close box
in the child window. It can be programmed to be ignored but that
leaves an enabled close box to confuse the user.

There are workarounds but I would prefer something less clumsy.

Thanks,
Gary
Jun 4 '07 #1
2 5897
On Mon, 04 Jun 2007 12:54:30 -0700, Gary Brown <ga********@charter.net>
wrote:
[...]
Is there an easy way to determine if a child form has been closed?
This is modeless, not MDI. I haven't found a already defined event
for this non-MDI case.
Every form has a FormClosed event, MDI or not. You should be able to
subscribe to that event to receive notification that the form has been
closed.

As far as disabling the close box goes, I'm not aware of any built-in way
to do that. I think you could probably override the window class and draw
your own close box, but that's not really a .NET-friendly way to do it.
Maybe if you can explain why simply removing the control box altogether
isn't a good solution for you, someone can offer a suggestion that does
work better within the .NET paradigm.

Pete
Jun 4 '07 #2
may be you should put the child form into singleton pattern, then null the
form after it closed

--
cheers,
RL
"Gary Brown" <ga********@charter.netwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
Hi,

I need to either determine that a child form has been closed or
disable the close box without removing the entire control box.

Is there an easy way to determine if a child form has been closed?
This is modeless, not MDI. I haven't found a already defined event
for this non-MDI case. The form instance still resides in the parent
form. Is there something in it that can be checked?

What I have is:

if (CRT == null)
{
CType30CRT Display = new CType30CRT();
CRT.Show(this);
}

Also, there does not appear to be a means to disable the close box
in the child window. It can be programmed to be ignored but that
leaves an enabled close box to confuse the user.

There are workarounds but I would prefer something less clumsy.

Thanks,
Gary


Jun 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Irvin Amoraal | last post by:
Process: I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
2
by: Ron L | last post by:
I have an MDI application which opens a number of child windows, each of which could have data in a state that needs to be saved. Each child window catches its Closing event and cancels it if the...
2
by: Chris | last post by:
I'm working on a MDI application, and I would like to notify the app's main form when a child form has been closed. What's the best way to do this? I was thinking about sending a message to the...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Simon | last post by:
I setup a Midi & Child form I can open the child form and display info from a Text file I need to enable the user to change info on the child form and when closed write the text file back to...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
12
by: Phil | last post by:
I can check for MdiChildren.Length=0, but which event handler should I put this in to detect when a child window is closed? TIA Phil.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.