title: Hiding a form and showing another when a button is clicked in a Windows Forms application
body: <p>I am doing an application a Windows Form application. At first, a certain form appears, and after the user hits the next button, this form should be hidden and another form is shown.</p>
  
  <p>I tried to do it. I managed to hide the current form, but the next one won't show.</p>
  
  <p>Here is my attempt:</p>
  
  <p>This is the button's event handler</p>
  
  <pre><code>private void button1_Click_1(object sender, EventArgs e)
  {
      if (richTextBox1.Text != null)
      {
          this.Visible=false;
  
  
      }
      else
          MessageBox.Show("Insert Attributes First !");
  }
  </code></pre>
  
  <p>This is the main function:</p>
  
  <pre><code>static void Main()
  {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Form2 form2 = new Form2();
      Form1 form1 = new Form1();
      form2.Hide();
      Application.Run(form1);
      while (true)
      {
          if (form1.Visible == false)
              form2.Show();
      }
  }
  </code></pre>