I will use Application.Exit Method.
Herfried K. Wagner [MVP] - 29 Oct 2004 11:19 GMT
"Rulin Hong" <RulinHong@discussions.microsoft.com> schrieb:
>I will use Application.Exit Method.
This method will work similar to 'End'. I would try to avoid using both of
these methods and close the main form instead.

Signature
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/
jela - 29 Oct 2004 22:04 GMT
environment.exit
Never failed me before.
Is it nice ? Probably not.
Does it kill everything? Yes.
"Bob" <noone@nowhere.com> wrote
> My app shows a modal MDI parent form, and creates a timer that ticks every
> ten minutes to boot unresposive users at 3 in the morning. Below is a
[quoted text clipped - 3 lines]
> the timer, and any others that happen to be still open in the MDI parent
> itself - so frm.Close does not work.
It could work, if you designed it to work....
You could create a class whose sole responsibility is to raise a ShutDown
event and have all your forms listen for that event and close themselves down
(gracefully) when it happens. It may mean you have to create your own
MessageBox to display messages, but the 15 minutes you might use to do
that will provide you with a proactive means to be sure everything closes.
(Be aware you may not know which order the individual forms will recieve
that ShutDown event notification, so each form should just handle shutting
themselves down)
Instead of calling End, you could just send a call to that class to raise
the ShutDown event, and then exit out of the current sub. With all forms
closed, and no code executing, your application should close in a nice
clean fashion.
LFS
Bob - 29 Oct 2004 14:28 GMT
> It could work, if you designed it to work....
>
[quoted text clipped - 13 lines]
>
> LFS
Um... hmmm.
Yes, even though it's 130MB of code (most of it forms designer bloat) with
both inputboxes and messageboxes, I suppose it wouldn't take too long to
search and replace all of these.
I just have to shake my head, though, I would have thought MS would have put
in a facility to close all an app's dialogues automatically by now. *shrug*
I think I'm going to dig around for a way to detect and kill all dialogues
first (exluding the main MDI form of course). I bet there's a way.
Bob