title: How to end process after closing whole application in C#.NET?
body: <p>I have a .NET 2005 (C#) desktop application, in which there is a login form and an MDI form, which then have multiple subforms.  All other forms are opened in MDI form only.</p>
  
  <p>After a user logs in, I hide the login form and then show the MDI form, but when I close the MDI form, my application process does not end because the login form is still hidden. I want that, when the user closes the MDI form, the whole application should close (essentially, the process should not be shown in the task manager), because if everytime the user closes and reopens the application and logs in, it will create some performance problem.</p>
  
  <p>I am doing something like below:</p>
  
  <pre><code>//my login validation script,
  
  //after successful login
  
  this.Hide();
  
  if (globalData.ObjMdiMain.IsDisposed)
  {
      globalData.ObjMdiMain = new mdiMain();
  }
  globalData.ObjMdiMain.Show();
  </code></pre>
  
  <p><code>globalData</code> is my static class where I create global objects which are required by the whole application. There, I have defined the <code>ObjMdiMain</code> object of my MDI form and I am accessing it here in the login form.</p>
  
  <p>So, is there any method or function which will end the whole process from system, something like "Application.End();" or something else?</p>
  
  <p>Thanks!</p>