469,950 Members | 2,265 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Closing Event in MDI Child Forms

In VB.Net, What events (if any), does an MDI child form
get when the application closes, which I can use to cancel
the close?
I am relying on the Closing event, which fires when the
form itself closes, however this doesn't fire when the
application closes. I can't find any alternative.
Nov 20 '05 #1
7 5585
"Geoff Olding" <Ge**********@CityComputers.co.uk> schrieb
In VB.Net, What events (if any), does an MDI child form
get when the application closes, which I can use to cancel
the close?
I am relying on the Closing event, which fires when the
form itself closes, however this doesn't fire when the
application closes. I can't find any alternative.


It does fire when the application closes - unless you kill your app the hard
way by using "End" or "Application.Exit".
--
Armin

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

Nov 20 '05 #2

I don't get this result, I cannot get the event to fire whichever way I
close down the application
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
* Geoff Olding <ge**********@citycomputers.co.uk> scripsit:
I don't get this result, I cannot get the event to fire whichever way I
close down the application


Maybe you want to "subscribe" to the 'MdiParent''s 'Closing' event using
'AddHandler'/'RemoveHandler'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
"Geoff Olding" <ge**********@citycomputers.co.uk> schrieb

I don't get this result, I cannot get the event to fire whichever way
I close down the application


_How_ do you close the application? Is there an End statement or
Application.Exit anywhere? What if you set a breakpoint in the MDI
container's closing and/or closed events? Are they hit? What does the
callstack say when they are?

Can you reproduce it in a new project?
--
Armin

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

Nov 20 '05 #5
In response to your questions:

The application is closed in two ways: - the user can either close down
the MDI form from the control box, or use an "Exit" menu item, which
just does the following:
Me.Close

The application stops on breakpoints in the Closing and Closed Events
(in th elater case, provided I temporarily remove some code I have on
the MDI form's "onClosed" event)
The Callstack on "Closing" is as follows:
Polygonal.exe!Polygonal.frmMdi.frmMdi_Closing(Obje ct sender =

{Polygonal.frmMdi}, System.ComponentModel.CancelEventArgs e =
{System.ComponentModel.CancelEventArgs}) Line 1450 Basic
[<Non-user Code>]
Polygonal.exe!Polygonal.basGlobal.Main() Line 39 + 0xb bytes Basic

The problem can be reproduced in a new project - I have created a simple
project with an MDI form and an MDI child form and get the same problem

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #6
Thanks - this has done the trick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #7
"Geoff Olding" <ge**********@citycomputers.co.uk> schrieb
Thanks - this has done the trick


I don't understand this. You wrote:

"I am relying on the Closing event, which fires when the
form itself closes, however this doesn't fire when the
application closes."

Now the Closing event does fire?
--
Armin

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

Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Bruce | last post: by
6 posts views Thread by Barry Gast | last post: by
6 posts views Thread by **Developer** | last post: by
4 posts views Thread by Franky | last post: by
14 posts views Thread by =?Utf-8?B?UHVjY2E=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.