3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by buster2209
Featured Replies
  • [QUOTE=buster2209;1311390]How can this be done? What about the Application.Exit() function? I am looking to execute some code when the user presses the 'x' at the top right of the screen[/QUOTE] [CODE] private void form1_FormClosing( object sender , FormClosingEventArgs e ) { //code }[/CODE] Dont forget to attach the event handler. … Read More

0

How can this be done?

What about the Application.Exit() function?

I am looking to execute some code when the user presses the 'x' at the top right of the screen

1

How can this be done?

What about the Application.Exit() function?

I am looking to execute some code when the user presses the 'x' at the top right of the screen

private void form1_FormClosing( object sender , FormClosingEventArgs e )
{
       //code
}

Dont forget to attach the event handler. This should go into your Form1.designer.cs

this.FormClosing += new System.Windows.Forms.FormClosingEventHandler( this.Watcher_FormClosing );

EDIT: Yes,this will affect any maner you try to exit the application.

Edited by PierlucSS: n/a

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.