Close button on MDI parent

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

Guest

When user click on the "x" close button on the MDI parent form, how can I set
an event handler on it? I want to save some settings before the form is
closed. Some forum mentions associate it with the cancel button, there is no
button here.

Anthony.
 
Anthony,

Have you looked into the FormClosing event on the parent form? That
should fire when the X button is clicked.
 
When user click on the "x" close button on the MDI parent form, how can I set
an event handler on it? I want to save some settings before the form is
closed. Some forum mentions associate it with the cancel button, there is no
button here.

Anthony.

Nicholas' post will solve your problem, but you might also want to
look into the OnClosed method of Form. If you override OnClosed in
your own form, you will receive a CloseReason (which will be
CloseReason.MdiFormClosing if your MdiParent is closing).

Alun Harford
 

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