469,920 Members | 2,366 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

File/Exit howto

Hi,

What is the standard code for closing down an application?.
Application.Exit(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?

Nov 16 '05 #1
3 1598
Hi Jesper Denmark,

this.dispose();

Correct me if i am wrong. Cheers.
--
Regards,
Chua Wen Ching :)
"Jesper Denmark" wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exit(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?

Nov 16 '05 #2
Jesper Denmark wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exit(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?


I use this.Dispose().
"this" being the form that is open.

This is what MSDN says on Application.Exit():

"This method stops all running message loops on all threads and closes
all windows of the application. This method does not force the
application to exit."

I think it does the job, you shouldn't worry about it.
It might be even better than Dispose() because it closes ALL windows,
dispose only closes one form.
Nov 16 '05 #3
Hi Nick,

Just curious,

If i had 2 forms.

FormA

FormB

FormA calls FormB, will close FormA, i use Application.Exit()

Yeah, i agree. Everytime i call this.dispose(), it kills off my whole program.

Thanks for the highlight. Learn something today.
--
Regards,
Chua Wen Ching :)
"Nick" wrote:
Jesper Denmark wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exit(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?


I use this.Dispose().
"this" being the form that is open.

This is what MSDN says on Application.Exit():

"This method stops all running message loops on all threads and closes
all windows of the application. This method does not force the
application to exit."

I think it does the job, you shouldn't worry about it.
It might be even better than Dispose() because it closes ALL windows,
dispose only closes one form.

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Josef Sachs | last post: by
2 posts views Thread by Matthew Thorley | last post: by
5 posts views Thread by alejandro lapeyre | last post: by
10 posts views Thread by Flex | last post: by
5 posts views Thread by Ouray Viney | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.