Why does Application.Exit Prompt me twice?
- by Michael Quiles
How can I stop the message box from showing up twice when I press the X on the form
? FYI the butoon click works fine it's the X that prompts me twice.
private void xGameForm_FormClosing(object sender, FormClosingEventArgs e)
{
//Yes or no message box to exit the application
DialogResult Response;
Response = MessageBox.Show("Are you sure you want to Exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (Response == DialogResult.Yes)
Application.Exit();
}
public void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}