window question

  • Thread starter Thread starter Analizer1
  • Start date Start date
A

Analizer1

how to catch the event when a user clicks
the system menu [x] to close a window
is FormClosed and FormCloseing the correct Events

thanks
 
In the InitializeComponent method try adding:

this.Disposed += new System.EventHandler(this.Form1_Disposed);

and then create the method to which the delegate points:

private void Form1_Disposed(object sender, EventArgs e)

That should work.

Kofi Sarfo
 
Yes.
FormClosing is called first; this gives you the opportunity to say
"no" by setting e.Cancel = true (i.e. prompt to save etc). After that,
the form actually closes and FormClosed is raised.

Marc
 
Back
Top