private void btn_LogIn_Click(object sender, EventArgs e) { if ((txt_UserName.Text.ToUpper() == "TECHLINK" && txt_Password.Text == "123456") || (txt_UserName.Text.ToUpper() == "TUANANH" && txt_Password.Text == "123456") || (txt_UserName.Text.ToUpper() == "HOANGTRIEU" && txt_Password.Text == "123456")) { this.Hide(); NewRecord menu = new NewRecord(); menu.Closed += (s, args) => this.Close(); menu.Show(); } else { MessageBox.Show("Wrong Password or User name"); } }
private void CheckEnterKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if ((txt_UserName.Text.ToUpper() == "TECHLINK" && txt_Password.Text == "123456") || (txt_UserName.Text.ToUpper() == "TUANANH" && txt_Password.Text == "123456") || (txt_UserName.Text.ToUpper() == "HOANGTRIEU" && txt_Password.Text == "123456")) { this.Hide(); NewRecord menu = new NewRecord(); menu.Closed += (s, args) => this.Close(); menu.Show(); } else { MessageBox.Show("Wrong Password or User name"); } } }