By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,540 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

Application.Exit() doesn't react

P: n/a
Hi,

After a given exception I would like to terminate the
program. I've been told that Application.Exit() should do
the trick, but I cant seem to make it work at all. It
compiles fine. But it doesn't seem to do anything - the
program just continues after calling the function. Should
it be in a certain scope or called via the object that
was given as an argument to Application.Run?

Please help.
Jesper.
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
What about Environment.Exit()

Josť
"Jesper Denmark" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Hi,

After a given exception I would like to terminate the
program. I've been told that Application.Exit() should do
the trick, but I cant seem to make it work at all. It
compiles fine. But it doesn't seem to do anything - the
program just continues after calling the function. Should
it be in a certain scope or called via the object that
was given as an argument to Application.Run?

Please help.
Jesper.

Nov 15 '05 #2

P: n/a
Hi Jesper,

In the MSDN is clearly stated that a call to this method does not force the
application to exit, try to use a Application.DoEvents() after it as it will
process the messages in the queue.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Jesper Denmark" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Hi,

After a given exception I would like to terminate the
program. I've been told that Application.Exit() should do
the trick, but I cant seem to make it work at all. It
compiles fine. But it doesn't seem to do anything - the
program just continues after calling the function. Should
it be in a certain scope or called via the object that
was given as an argument to Application.Run?

Please help.
Jesper.

Nov 15 '05 #3

P: n/a
Jesper,

Are you exiting whatever event handler you are in after you make the
call? If you are on the UI thread and make the call, then you should return
from your method and then let the main message loop process the WM_QUIT
message (which is what is sent to your app when you call the Quit method).
If you keep performing processing, then the loop has to wait until your
processing is done to process the event.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jesper Denmark" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Hi,

After a given exception I would like to terminate the
program. I've been told that Application.Exit() should do
the trick, but I cant seem to make it work at all. It
compiles fine. But it doesn't seem to do anything - the
program just continues after calling the function. Should
it be in a certain scope or called via the object that
was given as an argument to Application.Run?

Please help.
Jesper.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.