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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top