Detecting open MDI Childs when MDI parent is closed

TabsTheCat

New member
Joined
Dec 16, 2010
Messages
3
Programming Experience
10+
Hi

I'm new to VB 2010 but have be using VB6 for many years.

I'm currently stuck trying to store the state of open MDI childs at the moment the MDI parent is closed. Clicking the parent upper right close button appears to close all open MDI childs before running the parent 'Closing' or 'Disposed' events.

I am therefore unable to detect which MDI childs are open and cannot restore them next time the application is run.

Is there any other event for the MDI parent I can detect the start of the closing process before the children are closed?

Thanks in advance
 
Closing event has been obsolete for many years now (it is even hidden from IDE/code editor), you should use FormClosing event. Not that it matter for the result you're after, MdiChildren collection contains the open mdi children in both cases.
To further enlightenment, FormClosing event "occurs before the form is closed", no actual closing process has started at this point. This event is also cancelable, so if you cancel it nothing has really happened since the request for close was initiated.
 
Thank you JohnH

The MdiChildren method was exactly what I needed, all working now, thanks.

To further enlightenment, FormClosing event "occurs before the form is closed", no actual closing process has started at this point. This event is also cancelable, so if you cancel it nothing has really happened since the request for close was initiated.
If I placed breakpoints on the MDIchildren Disposed events, these where called before the MDIparent Disposed event was called so I assumed the children where already being closed and the parent would be last.
 
Back
Top