472,807 Members | 3,552 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 software developers and data experts.

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

Similar topics

2
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...
4
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...
2
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...
5
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,...
1
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...
2
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...
1
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...
0
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...
19
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.