473,654 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3673
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.ActiveMdiChi ld.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*******@disc ussions.microso ft.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.ActiveMdiChi ld.Close()
Next frmChild
///
Regards Steve

Nov 20 '05 #3
"Barry Gast" <ba****@nycap.r r.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.exi t 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*******@free net.de> wrote in message
news:#u******** ******@TK2MSFTN GP12.phx.gbl...
"Barry Gast" <ba****@nycap.r r.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.exi t 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.r r.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.Exi t 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*******@free net.de> wrote in message
news:ek******** ******@TK2MSFTN GP10.phx.gbl...
"Barry Gast" <ba****@nycap.r r.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1845
by: Nenad Dobrilovic | last post by:
Hi, is there any way to find out how form was closed (by calling it's method Close() or by clicking on the 'close' button in control box)? Also, can I close the form in that way that Cloing/Closed events are not triggered?
4
3592
by: Gas | last post by:
Hi, I am a totally C# newbie from VB6. In my App, I don't know why the form_closing event is never being raised when I click on the "x" button at the corner my App, Can anyone give me some hints? Also I want to know how can I get a list of events for an object( say form) just like the combo box we use in VB6 editor (at the top)?
2
2036
by: Bob Cummings | last post by:
Greetings I am sure this is a simple question. But I have "googled" it to death and have only found one answer that involved a bunch of window's API calls that I did not understand. I am a student taking VB.NET and we are studying the Validation event and how to use it on text boxs. I have set the forms.causevalidation property to false. But if the user has bad data in the text box and just wants to quit the program by clicking on...
5
1596
by: John | last post by:
Hi I have a main form that contains a panel which contains a child form. The problem is that when the main form is closed by the user, the 'closing' event for the child form is not triggered, which I need to do some cleanup in the child form. What is the problem and is there a workaround? Thanks Regards
1
1407
by: Marius Groenendijk | last post by:
Dear Group, I have a MDI with children which may be editing data. If a MDI child closes its Closing handler asks a question 'exit w/out saving?'. On closing the MDI its pops a question 'Exit app?'. If the MDI closes *first* the questions asked by the MDI children appear and *then* the question by the MDI. This is because the closing events in the MDI children get fired *first* while Closing the MDI.
2
3017
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then and then attempts to close the window (either via my custom 'Close' box or by clicking the close 'X' in the upper right window corner), the validation event still triggers and it tells the user that they have invalid data. Which of course means...
1
1628
by: =?Utf-8?B?Q2hyaXNB?= | last post by:
Two questions: 1. I have several asp.net pages that initiate a file download, via Response.WriteFile(). This works fine, except that it leaves the original page up. These pages are generally launched in new windows, so I'd prefer that they go away by themselves. Can anyone suggest a way to have the page close by itself? 2. I have tried to disable the remaining page so that the user can't re-submit. While it's easy enough to toggle...
0
960
by: ragunath79 | last post by:
Hi, i am calling window.close event in onclick event of close button in Asp.net master page to close window. I used window.onbeforeunload event in content page(of same master page) to show warning message for unsaved data. There was a problem. if i click close button in the master page it is not closing the window. instead the warning message that was returned from onbeforeunload event is firing and return to the same page where it is. ...
19
3222
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
0
8290
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
8815
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...
0
8708
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8594
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
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
2
1596
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.