title: C# Opening a new form and closing the other one
body: <p>In my program I show a login form before the main form, once the program detects a successful login I use this:</p>
  
  <pre><code>MainForm Main = new MainForm();
  Main.Show();
  this.Hide();
  </code></pre>
  
  <p>This works fine but there is a problem, the login form is still open even though it is hidden so when the program is closed the process still hangs, how can I stop this from happening?</p>
  
  <p>Sorry, forgot to add, using <code>this.Close();</code> doesn't work and will completely close the program.</p>