Hi,

I am wondering what is the proper way to terminate an MDI app that has
"dirty" forms.

In my case, the child form is editing some data. If the user presses the
"X" button on the main form, the code I have is

parent_Closing (...) handles MyBase.Closing
Application.Exit()
End Sub

When the Application.Exit()ethod runs it causes the the closing event to run
in the child form. The chid's Closing event brings up a dialog that display
a message about lossing your changes and gives the user the options to Save
changes and close, abandon changes, or cancel the close. If they select the
cancel close method, e.cancel is set to True. I assumed that this would
cause the Application.Exit to cancel, but it apparently does not. So the
question is what is the proper way to give the user a chance to abort the
close?

Thanks,

Jerry

Re: What is the proper way to terminate your MDI app and allow user abort of close by Jay

Jay
Wed Sep 10 14:01:03 CDT 2003

Jerry,
In the MDI parent, I would close each of my (MDI) children (with
Form.Close). If after closing all of my children if there are any left open
(unsaved data) I would let the app keep running otherwise I would close the
MDI parent (with either Form.Close or Application.Exit).

I would not use Application.Exit only unless I clearly needed to app to
terminate immediately. As Application.Exit causes the Win32 message pump to
exit, which causes the Application.Run to return in your Main routine.

Hope this helps
Jay

"JerryK" <jerryk@insteptech.com> wrote in message
news:%23nuhXl8dDHA.2324@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I am wondering what is the proper way to terminate an MDI app that has
> "dirty" forms.
>
> In my case, the child form is editing some data. If the user presses the
> "X" button on the main form, the code I have is
>
> parent_Closing (...) handles MyBase.Closing
> Application.Exit()
> End Sub
>
> When the Application.Exit()ethod runs it causes the the closing event to
run
> in the child form. The chid's Closing event brings up a dialog that
display
> a message about lossing your changes and gives the user the options to
Save
> changes and close, abandon changes, or cancel the close. If they select
the
> cancel close method, e.cancel is set to True. I assumed that this would
> cause the Application.Exit to cancel, but it apparently does not. So the
> question is what is the proper way to give the user a chance to abort the
> close?
>
> Thanks,
>
> Jerry
>
>



Re: What is the proper way to terminate your MDI app and allow user abort of close by JerryK

JerryK
Wed Sep 10 14:28:04 CDT 2003

Jay,

Sounds interesting, I'll see if that will work.

Thanks,

Jerry


"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@email.msn.com> wrote in message
news:OM9Om38dDHA.2524@TK2MSFTNGP09.phx.gbl...
> Jerry,
> In the MDI parent, I would close each of my (MDI) children (with
> Form.Close). If after closing all of my children if there are any left
open
> (unsaved data) I would let the app keep running otherwise I would close
the
> MDI parent (with either Form.Close or Application.Exit).
>
> I would not use Application.Exit only unless I clearly needed to app to
> terminate immediately. As Application.Exit causes the Win32 message pump
to
> exit, which causes the Application.Run to return in your Main routine.
>
> Hope this helps
> Jay
>
> "JerryK" <jerryk@insteptech.com> wrote in message
> news:%23nuhXl8dDHA.2324@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I am wondering what is the proper way to terminate an MDI app that has
> > "dirty" forms.
> >
> > In my case, the child form is editing some data. If the user presses
the
> > "X" button on the main form, the code I have is
> >
> > parent_Closing (...) handles MyBase.Closing
> > Application.Exit()
> > End Sub
> >
> > When the Application.Exit()ethod runs it causes the the closing event to
> run
> > in the child form. The chid's Closing event brings up a dialog that
> display
> > a message about lossing your changes and gives the user the options to
> Save
> > changes and close, abandon changes, or cancel the close. If they select
> the
> > cancel close method, e.cancel is set to True. I assumed that this
would
> > cause the Application.Exit to cancel, but it apparently does not. So
the
> > question is what is the proper way to give the user a chance to abort
the
> > close?
> >
> > Thanks,
> >
> > Jerry
> >
> >
>
>