title: In C# how to open third form inside first form when i click a button of the second form
body: <p>In my <code>Windows Forms</code> application, I have 3 different <code>Form</code>s (<em>Form1, Form2, Form3</em>)</p>
  
  <ul>
  <li><p><strong>Form1</strong> Contains a Button and a Panel (button1, panel1)</p>
  
  <p><img src="https://i.stack.imgur.com/YFUKC.jpg" alt="Form1 Image"></p></li>
  <li><p><strong>Form2</strong> Contains only a button (button)</p>
  
  <p><img src="https://i.stack.imgur.com/1w1TL.jpg" alt="Form2 Image"></p></li>
  <li><p><strong>Form3</strong> Contains nothing</p>
  
  <p><img src="https://i.stack.imgur.com/fKau5.jpg" alt="Form3 Image"></p></li>
  </ul>
  
  <p>In Form1 when I click button1 , Form2 opens in panel1</p>
  
  <p><img src="https://i.stack.imgur.com/xCMyv.jpg" alt="(see in image)"></p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      panel1.Controls.Clear();
      Form2 f2 = new Form2();
      f2.TopLevel = false;
      panel1.Controls.Add(f2);
      f2.Dock = DockStyle.Fill;
      f2.Show();
  }
  </code></pre>
  
  <p><strong>Now, inside Form2, when i click the button, I want the Form3 open inside Form1's panel, I've tried this code...</strong></p>
  
  <pre><code>Form1 f1 = new Form1();
  private void button1_Click(object sender, EventArgs e)
  {
      f1.panel1.Controls.Clear();
      Form3 f3 = new Form3();
      f3.TopLevel = false;
      f1.panel1.Controls.Add(f3);
      f3.Dock = DockStyle.Fill;
      f3.Show();
  }
  </code></pre>
  
  <p><strong><em>Note: In Form1 I've changed the modifier to public for the Panel</em></strong></p>