title: MessageBox on Form Closing
body: <p>I'm use this code for question before closing the application, but it is not working correctly.<br>
  My code is as below.</p>
  
  <pre><code>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();
     }
  }
  </code></pre>