S
Stefanie Knapp
Hi,
I've got a problem with a .NET 2.0 application: When I try to cancel
the FormClosing event of the main form of the program (e.Cancel =
true), this same event is performed a second time (now it can be
cancelled successfully). The first time the FormClosing-method is
called with CloseReason.UserClosing, second time with
CloseReason.ApplicationExitCall. There is no call of Application.Exit()
before the FormClosing method is performed.
The form is an MDI parent, and this happens only when the MdiChildren
list is empty.
void MainFrame_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show(this, "Do you really want to exit?", "Exit
program?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) !=
DialogResult.Yes)
{
e.Cancel = true;
return;
}
}
Why is the FormClosing event performed a second time with
CloseReason.ApplicationExitCall? Any suggestions?
Thanks in advance
Stefanie
I've got a problem with a .NET 2.0 application: When I try to cancel
the FormClosing event of the main form of the program (e.Cancel =
true), this same event is performed a second time (now it can be
cancelled successfully). The first time the FormClosing-method is
called with CloseReason.UserClosing, second time with
CloseReason.ApplicationExitCall. There is no call of Application.Exit()
before the FormClosing method is performed.
The form is an MDI parent, and this happens only when the MdiChildren
list is empty.
void MainFrame_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show(this, "Do you really want to exit?", "Exit
program?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) !=
DialogResult.Yes)
{
e.Cancel = true;
return;
}
}
Why is the FormClosing event performed a second time with
CloseReason.ApplicationExitCall? Any suggestions?
Thanks in advance
Stefanie