473,508 Members | 4,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5743
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2504
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...
1
5798
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
8
4164
by: al | last post by:
Greetings, If I instansiate child forms in MDI parent, what is the way to close them. I can't find an event related to child to do such task. I want to close 3 child forms, all in the same...
6
3662
by: Barry Gast | last post by:
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...
10
3984
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...
3
2766
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
3
6351
by: Oenone | last post by:
I'm writing an application with various MDI child forms. In the Closing event of many of the forms, I have code that asks the user whether he is sure he wants to close the form, because it...
6
1660
by: **Developer** | last post by:
I've been looking but can't find out how in a form Closing event to know if the closing is because the form's "X" had been clicked or the main form's "X" was clicked. That is, I need to know if...
4
4032
by: Franky | last post by:
The Closing event is broadcast by the multi-cast delegate which sends the event to all subscribed delegates. I wonder if the MDI container receives this event and then sends one to each...
14
3334
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
0
7228
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
7128
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
7393
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...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.