Stopping an application from closing

  • Thread starter Thread starter Joe_Black
  • Start date Start date
J

Joe_Black

Hi All,

I want to stop my app from closing, unless the user specifically wants
it to, I use this code:

private void MainForm_Closing(object sender,
system.ComponentModel.CancelEventArgs e)
{
if(MessageBox.Show("Are you sure you wish to close Millenium?",
"Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.No)
{
e.Cancel = true;
}
}

The main form of my application calls this function on the Closing event.

The problem is this function never gets called, does any one know why
this may be the case, or should I be doing this elswhere?

Thanks

Joe
 
Joe_Black said:
Hi All,

I want to stop my app from closing, unless the user specifically wants
it to, I use this code:

private void MainForm_Closing(object sender,
system.ComponentModel.CancelEventArgs e)
{
if(MessageBox.Show("Are you sure you wish to close Millenium?",
"Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.No)
{
e.Cancel = true;
}
}

The main form of my application calls this function on the Closing event.

The problem is this function never gets called, does any one know why
this may be the case, or should I be doing this elswhere?

Thanks

Joe

All Sorted, thanks anyway

Joe
 
Back
Top