title: C# login examples
body: <p>I am having trouble hiding my main form for a login form. Once user has logged in to close login form and show main form.</p>
  
  <p>I have been confusing myself that much I have deleted all code and started fresh. I can hide the login form fine.</p>
  
  <p>I was unable to hide the main form called with</p>
  
  <pre><code>Application.Run(new MainForm());
  </code></pre>
  
  <p>Login form looks like this:</p>
  
  <pre><code>namespace WindowsFormsApplication1
  {
      public partial class LoginForm : Form
      {
          public LoginForm()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              string username;
              string password;
  
              username = TB_username.Text;
              password = TB_password.Text;
  
              if (User.Login(username, password))
              {
                  Globals._Login = true;
  
                  // Close login form
                  this.Dispose(false);
  
              }
              else
              {
                  MessageBox.Show("Login Failed");
              }
  
          }
      }
  }
  </code></pre>
  
  <p>I cant figure out how to hide then show the main form once login has passed.</p>
  
  <p>Thanks any examples would be great</p>