title: Close a Form or multiple Forms opened in a UserControl
body: <p>I have a main Form (<code>Form1</code>) with an UserControl (<code>ucModule2</code>).<br>
  <code>ucModule2</code> contains a button (<code>simpleButton1</code>) which opens another Form (<code>Form2</code>).<br>
  On <code>Form1</code>, I have a button (<code>UsrCtrlDialog</code>) which should close <code>Form2</code>.  </p>
  
  <p>I have two scenarios: </p>
  
  <p><strong>Scenario 1:</strong>
  My <code>ucModule2.cs</code>:</p>
  
  <pre><code>public partial class ucModule2 : UserControl
  {
      public static Form2 fr2 = new Form2();
      private void simpleButton1_Click(object sender, EventArgs e)
      {
          //Form2 fr2 = new Form2();
          fr2.Show();
          fr2.TopMost = true;
          textModule2 = textBox_ucModule2.Text;
      }
   }
  </code></pre>
  
  <p><code>Form1</code>'s button used to close <code>Form2</code>:  </p>
  
  <pre><code>private void UsrCtrlDialog_Click(object sender, EventArgs e)
  {
      // Form2 fr2 = new Form2();            
      ucModule2.fr2.TopMost = false;
      ucModule2.fr2.Close();
      ucModule2.fr2.Dispose();
  }
  </code></pre>
  
  <p>In this scenario, <code>Form2</code> is opened only once and is closed when the <code>UsrCtrlDialog</code> button, from <code>Form1</code>, is closed. But if I want to open again <code>Form2</code>, I get, on <code>fr2.Show()</code>: </p>
  
  <blockquote>
    <p><code>System.ObjectDisposedException</code> exception ('Cannot access a disposed
    object.'`</p>
  </blockquote>
  
  <p>I know that when I want to open again <code>Form2</code>, a new object of <code>Form2</code> type isn't created.<br>
  What can I do to be able to open a new Form2 after the old one was closed?</p>
  
  <p><strong>Scenario 2:</strong>
  My <code>ucModule2.cs</code>:</p>
  
  <pre><code>public partial class ucModule2 : UserControl
  {
      //public static Form2 fr2 = new Form2();
      private void simpleButton1_Click(object sender, EventArgs e)
      {
          Form2 fr2 = new Form2();
          fr2.Show();
          fr2.TopMost = true;
          textModule2 = textBox_ucModule2.Text;
      }
  }
  </code></pre>
  
  <p>In this scenario, I can open as many <code>Form2</code> windows as I click on <code>simpleButton1</code>. For example, I press 3 times <code>simpleButton1</code>. I will have 3 <code>Form2</code> windows.  </p>
  
  <p>How could close the 3 <code>Form2</code> windows when I press <code>UsrCtrlDialog</code> button form <code>Form1</code>? How could I get the <code>fr2</code> object from <code>ucModule2.cs</code> to <code>Form1.cs</code>?</p>