title: Close Form Button Event
body: <p>in my application, the user is first presented with the log in screen, and the form that shows up after you log in has a Menu Bar. On that menu bar are 2 items: "log out" and "exit". If the user selects the log out option, I want it to return to the aforementioned log in screen. If the user instead decided to click "exit", I prompt the user if they are sure they want to exit. Unfortunately, when the user decides to close the program by clicking the "X" button on the window, it closes only the current form. My intention would be for it to close the entire Application.</p>
  
  <p>Basically, I need to know how to exit the current application by intercepting the form closing event.</p>
  
  <p>Under Logout item Strip Code Is : </p>
  
  <pre><code> private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
   {
       Form_Login log = new Form_Login();
       this.Close();
       log.Show();
   }
  </code></pre>
  
  <p>Under The Exit item Strip Code Is :  </p>
  
  <pre><code> private void exitToolStripMenuItem_Click(object sender, EventArgs e)
   {
       if (MessageBox.Show("Are You Sure To Exit Programme ?","Exit",MessageBoxButtons.OKCancel)== DialogResult.OK)
       {
           Application.Exit();
       }
   }
  </code></pre>
  
  <p>And When I Click Exit Button It Close The Current Form and I Want To Close The Whole Application </p>