samedi 22 octobre 2016

C# Login to Load on Main Form

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.

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

        else
            MessageBox.Show("Invalid Login");


    }

Aucun commentaire:

Enregistrer un commentaire