469,913 Members | 2,443 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

MDI Children Closing Event Not Firing

Hi. I have an MDI Parent form with multiple child windows. When I close
the parent form, the Closing events of the children forms are not executing.
Do I have to close all the child forms in the parent's closing event in
order to get the closing events of the children forms to execute?

Thanks.

-Barry
Nov 20 '05 #1
6 3499
Possibly not exactly what you are looking for but I would
use this to close all active children:

\\\
Dim frmChild As Form
For Each frmChild In Me.MdiChildren()
Me.ActiveMdiChild.Close()
Next frmChild
///
Regards Steve
Nov 20 '05 #2
That works for the events, but now I can't seem to get the
CancelEventArgs.Cancel property to "bubble-up" back to the parent MDI form
to prevent it's closing.

Any ideas?

-Barry
"Steven Smith" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
Possibly not exactly what you are looking for but I would
use this to close all active children:

\\\
Dim frmChild As Form
For Each frmChild In Me.MdiChildren()
Me.ActiveMdiChild.Close()
Next frmChild
///
Regards Steve

Nov 20 '05 #3
"Barry Gast" <ba****@nycap.rr.com> schrieb
Hi. I have an MDI Parent form with multiple child windows. When I
close the parent form, the Closing events of the children forms are
not executing. Do I have to close all the child forms in the parent's
closing event in order to get the closing events of the children
forms to execute?


No, the Closing events should fire in the child windows. How do you close
the MDI parent? If you call application.exit or even execute "End", the app
is killed the hard way => no closing events fired.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
DOH!

That was it.

Thanks Armin.

-Barry

"Armin Zingler" <az*******@freenet.de> wrote in message
news:#u**************@TK2MSFTNGP12.phx.gbl...
"Barry Gast" <ba****@nycap.rr.com> schrieb
Hi. I have an MDI Parent form with multiple child windows. When I
close the parent form, the Closing events of the children forms are
not executing. Do I have to close all the child forms in the parent's
closing event in order to get the closing events of the children
forms to execute?
No, the Closing events should fire in the child windows. How do you close
the MDI parent? If you call application.exit or even execute "End", the

app is killed the hard way => no closing events fired.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
"Barry Gast" <ba****@nycap.rr.com> schrieb
DOH!

That was it.


HOw do you do it now?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
The closing events of the child forms now fire, and the cancel property of
the CancelEventArgs parameter "bubbles-up" back to the MDI form.

My close function originally had the Application.Exit command in it, which
by-passed all the closing events of all the forms. Now I just issue a
Me.Close command for the MDI Parent form, and my Sub Main() handles the rest
of the application closing functions.

Thanks!

-Barry

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
"Barry Gast" <ba****@nycap.rr.com> schrieb
DOH!

That was it.


HOw do you do it now?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nenad Dobrilovic | last post: by
4 posts views Thread by Gas | last post: by
2 posts views Thread by Bob Cummings | last post: by
5 posts views Thread by John | last post: by
1 post views Thread by Marius Groenendijk | last post: by
1 post views Thread by =?Utf-8?B?Q2hyaXNB?= | last post: by
19 posts views Thread by zacks | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.