R
RSH
I am trying to figure out how I can trap the Closing Event that occurs when
a user attempts to close the window by clicking on the red"X".
I tried this code which I found online but nothing happens.
What do I need to do to trap and give the ability to save changes before the
window closes?
Thanks,
Ron
private void frmDataEditGrid_Closing(object sender, CancelEventArgs e)
{
e.Cancel = true;
if (MessageBox.Show("Do you want to save changes to your text?", "My
Application",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
e.Cancel = true;
}
}
a user attempts to close the window by clicking on the red"X".
I tried this code which I found online but nothing happens.
What do I need to do to trap and give the ability to save changes before the
window closes?
Thanks,
Ron
private void frmDataEditGrid_Closing(object sender, CancelEventArgs e)
{
e.Cancel = true;
if (MessageBox.Show("Do you want to save changes to your text?", "My
Application",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
e.Cancel = true;
}
}