Ivar
I tried the loop you suggested, but I still don't seem to be able to catch
the cancel from the individual windows closing to be able to keep the
application from exiting. Do you have any suggestions on this?
Here is my close handler:
' Catch the application exit event and gracefully close all MDI child
windows
Private Sub ApplicationExiting(ByVal sender As System.Object, _
ByVal e As System.ComponentModel.CancelEventArgs)
Handles _mainView.Closing
MessageBox.Show("Exiting the app!")
For Each frm As Form In _mainView.MdiChildren
frm.Close()
Next
End Sub
Thanks,
Ron L
"Ivar" <iv*@lumisoft.ee> wrote in message
news:uK**************@TK2MSFTNGP10.phx.gbl...
Hi,
What about:
mainMID.Closing += new
System.ComponentModel.CancelEventHandler(this.Wind ow_Closing);
private void Window_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
// Loop all childs and see if can close or save or ... do what you need
foreach(Form frm in this.MdiChildren){
}
}
At least this works ok for me.
"Ron L" <ro**@bogus.Address.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...I have an MDI application with a number of child windows. In each child
window I am catching the Closing event and having the child window decide
if it should set cancel to true. The intent here is to ensure that no
child window can close while it is in a state where user entered
information can be lost. I have just noticed that while the Closing event
is caught if I click the X on the child window, it is not caught if I
click the X on the MDI parent window. Is there some other event that I am
missing here?
Thanks,
Ron L