C# Login to Load on Main Form
<p>I have 2 Forms, Login(Form2) and Main(Form1) form. I want to load the Main form after typing the username and password correct and hide/close the login form at the same time.</p>

<pre><code>private void button1_Click(object sender, EventArgs e)
    {
        string username = "admin";
        string password = "admin";
        if ((textBox1.Text == username) &amp;&amp; (textBox2.Text == password))
            MessageBox.Show("Login Successful");

        else
            MessageBox.Show("Invalid Login");


    }
</code></pre>