public void btLogin_Click(object sender, EventArgs e) { string username = tbUsernameLogin.Text; string password = cs.Encrypt(tbPasswordLogin.Text); bool r = database.Login(username, password); if (r) { Main main = new Main(); Form1 form1 = new Form1(); main.Show(); } else { MessageBox.Show("Incorrect Login Credentials"); } }
private void btLogin_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string username = tbUsernameLogin.Text; string password = cs.Encrypt(tbPasswordLogin.Text); bool r = database.Login(username, password); if (r) { Main main = new Main(); Form1 form1 = new Form1(); form1.Close(); main.Show(); } else { MessageBox.Show("Incorrect Login Credentials"); } } }