Double confirmation on exit
Posted
by
Sean
on Stack Overflow
See other posts from Stack Overflow
or by Sean
Published on 2011-01-07T02:36:09Z
Indexed on
2011/01/07
2:53 UTC
Read the original article
Hit count: 343
I am trying to make it so that the user is prompted to confirm exiting my program in c#, but for some reason, if they say "yes" they would like to exit, the confirmation box would pop up again. I can't figure out why.
if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
e.Cancel = true;
}
else { Application.Exit(); }
© Stack Overflow or respective owner