I'm use this code for question before closing the application, but it is not working correctly.
My code is as below.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult dlgresult = MessageBox.Show("Exit or no?",
"My First Application",
MessageBoxButtons.YesNo,
MessageBoxIcon.Information);
if (dlgresult == DialogResult.No)
{
e.Cancel = true;
}
else
{
Application.Exit();
}
}