End application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I would like to be able to end my application when pushing a button. Like
the X in the upper right corner. How is this done. How do I send end app
event?

regards Jesper.
 
Hi,

I would like to be able to end my application when pushing a button. Like
the X in the upper right corner. How is this done. How do I send end app
event?

regards Jesper.

Depends. Assuming you are asking about a standard Windows Application
project. If the current code path is the main form, then just create a
command button control and in the Click event handler just do a:

this.Close();

If you are in a child form or dialog window, you will need to send
this information back to the main form. Closing the main form shuts
down the app.
 
Or, you can just call the static Exit method on the Application class,
which will send a WM_QUIT message to the main window and cause it to shut
down. This can be done from anywhere.
 
Hi,

Jesper said:
Hi,

I would like to be able to end my application when pushing a button. Like
the X in the upper right corner. How is this done. How do I send end app
event?

The Applicacion class has a method that let you do it.
Application.Exit will do it
 
Hej Jesper

Make a button Form1 object and write this.Close(); were "this" this is Form1
object
If I have read the questen right its work. .NET will activate the cloce
procidure for X in upper right corner

Regards

Kim S.
 
Back
Top