title: How to open usercontrol in a click of a button C#
body: <p>Firstly I had been searching about my problem and can't find \help.
  So my question is I've got 3 buttons and three <code>userControl</code> and when I click on one button it displays usercontrol 1 but after I click button 2. I cannot get back to usercontrol 1 im stuck in usercontrol2 and the button 1 does not do anything anymore.
  Here's my code: </p>
  
  <pre><code>public partial class Form2 : Form
  {
      UserControl1 u1;
      UserControl2 u2;
      UserControl3 u3;
      public Form2()
      {
  
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          u1 = new UserControl1();
          u1.Dock = DockStyle.Fill;
          this.Controls.Add(u1);
  
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          u1.Hide();
  
          u2 = new UserControl2();
          u2.Dock = DockStyle.Fill;
          this.Controls.Add(u2);
      }
  
      private void button3_Click(object sender, EventArgs e)
      {
          u1.Hide();
          u2.Hide();
          u3 = new UserControl3();
          u3.Dock = DockStyle.Fill;
          this.Controls.Add(u3);
      }
  
      private void button4_Click(object sender, EventArgs e)
      {
          Application.Exit();
      }
  }
  </code></pre>
  
  <p>SOLVED CODE for other's who need :)
  ---></p>
  
  <pre><code>enter code here
  public partial class Form2 : Form
  {
      UserControl1 u1;
      UserControl2 u2;
      UserControl3 u3;
      public Form2()
      {
          u1 = new UserControl1();
          u2 = new UserControl2();
          u3 = new UserControl3();
                      InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
              {
                  u2.Hide();
                  u3.Hide();
                  u1.Show();
                  u1.Dock = DockStyle.Fill;
                this.Controls.Add(u1);
            }
      private void button2_Click(object sender, EventArgs e)
      {
          u1.Hide();
          u3.Hide();
          u2.Show();
          u2.Dock = DockStyle.Fill;
          this.Controls.Add(u2);
      }
      private void button3_Click(object sender, EventArgs e)
      {
          u1.Hide();
          u2.Hide();
          u3.Show();
          u3.Dock = DockStyle.Fill;
          this.Controls.Add(u3);
      }
  
      private void button4_Click(object sender, EventArgs e)
      {
          Application.Exit();
      }
  }
  </code></pre>