title: Closing Multiple Forms in C#
body: <p>I have total 3 forms (Form1, Form2 and Form3) in my Windows Forms Application.</p>
  
  <p>Form2 is log-in page. When user clicks on sign-in button in Form1, Form2 must be open and if user provides accurate username and password then Form3 is needed to open and to close both Form1 and Form2.</p>
  
  <p>How to code such thing in C#? I am using Microsoft Visual Studio 2012.</p>
  
  <p><strong>So far I have done following procedure:</strong></p>
  
  <p>double click the Form1 to get at the coding window and wrote-</p>
  
  <pre><code>Form2 secondForm = new Form2();
  </code></pre>
  
  <p>Just outside of the Form Load event</p>
  
  <p>&amp; inside the button, i wrote-</p>
  
  <pre><code>secondForm.Show();
  </code></pre>
  
  <p>So when I run the solution, Form2 is opened by clicking a button in Form1 (Works Perfectly!). But I have no idea how to close Form1 and Form2 when user enter correct username and password combination in Form2 to open Form3.</p>
  
  <pre><code>Form1 firstForm = new Form1();
  firstForm.Close();
  </code></pre>
  
  <p>isn't closing the form.</p>
  
  <p>Please guide me.</p>