How do I stop this thing?

  • Thread starter Thread starter Christopher Weaver
  • Start date Start date
C

Christopher Weaver

Application.Exit() isn't having the effect that I would like. I thought it
would cause the app to terminate regardless of what was going on. What's
the best scenario for shutting down an app?
 
In most real-world scenerios your applications should be prepared for graceful terminations, if possible, in all situations. In
other words, you want your app to have a chance to save settings, perform proper clean-up, etc. before exiting.

I don't believe that Application.Exit() is an immediate termination, but instead a graceful one. This means that your Form's
Closing event will be fired.

Your application should be able to handle termination while in the middle of long processes by periodically checking a state
variable such as "if (closing != true)" before continuing. This way, your application will not freeze when closing because you have
a process that is being stubborn.

hope it helps,
 
Hi,

The Application.Exit method stops all running message loops and closes all the
windows. It does not force the application to exit, just to return from the
Application.Run call.

If you want to force the application to exit immediately, you can use the
Environment.Exit method, which terminates the process.

Best regards,

Rodger

Sequence Diagram Editor - Draw sequence diagrams faster
<http://www.SequenceDiagramEditor.com>
 
Back
Top