473,758 Members | 2,340 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 5758
"Geoff Olding" <Ge**********@C ityComputers.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.Ex it".
--
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**********@c itycomputers.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**********@c itycomputers.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.Exi t 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!P olygonal.frmMdi .frmMdi_Closing (Object sender =

{Polygonal.frmM di}, System.Componen tModel.CancelEv entArgs e =
{System.Compone ntModel.CancelE ventArgs}) Line 1450 Basic
[<Non-user Code>]
Polygonal.exe!P olygonal.basGlo bal.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**********@c itycomputers.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
2521
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 user wants to save the data, but when the Application closes this event isn't thrown automatically. I added a loop to close each child window, but can't seem find how to catch the child window's cancel of the Closing event, so even if the user...
1
5821
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 MDI child window. My application does certain logic when the user actually closes the MDI child form by clicking the "X" in the upper right hand. My application, however, should not execute this logic if the user closes the MDI parent. I...
8
4180
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 parent. MTIA, Grawsha
6
3685
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 parent's closing event in order to get the closing events of the children forms to execute? Thanks. -Barry
10
4029
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
3
2776
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 the value to False, but I would have expected it to be False on entry. TIA Charles
3
6372
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 contains unsaved data. If the user clicks "No" then the code sets e.Cancel = True, which cancels the closure. This works just great. But when the user closes the MDI parent form, the cancellation seems to be completely ignored. The MessageBox...
6
1677
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 just the form is closing or the application is closing. Do you know how to tell?
4
4044
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 MDI-Child or is each child a subscriber to the first event mentioned here?
14
3366
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 I'll make the inactive forms invisible but this is creating a memory corruption problem when user close the form2 or form3 and not the formMain. My main form has a Next button which makes the main form invisible and starts a new form which I'll...
0
9299
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10076
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7287
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6564
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3832
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 we have to send another system
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2702
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.