G
Guest
I'm trying to make the FormClosing event work but nothing is happening. I
have a simple forms app with one form. When I click the X in the top right
corner it seems the Formclosing event is not firing. I first tried to run my
own messagebox, then copied code from
http://msdn2.microsoft.com/en-US/library/system.windows.forms.form.formclosing.aspx and it's not working. Is there something else I need to do?
private void frm2085_FormClosing(Object sender, FormClosingEventArgs e)
{
System.Text.StringBuilder messageBoxCS = new
System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason",
e.CloseReason);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel);
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "FormClosing Event");
//MessageBox.Show("close event fired");
//Cleanup(true, true);
}
have a simple forms app with one form. When I click the X in the top right
corner it seems the Formclosing event is not firing. I first tried to run my
own messagebox, then copied code from
http://msdn2.microsoft.com/en-US/library/system.windows.forms.form.formclosing.aspx and it's not working. Is there something else I need to do?
private void frm2085_FormClosing(Object sender, FormClosingEventArgs e)
{
System.Text.StringBuilder messageBoxCS = new
System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason",
e.CloseReason);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel);
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "FormClosing Event");
//MessageBox.Show("close event fired");
//Cleanup(true, true);
}