private void txt_first_validation_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) { if (txt_first_validation.Text == Public.password) { admin_menu menu = new admin_menu(); menu.Show(); return; } try { Public.first_validation_door_id = txt_first_validation.Text.Substring(0, 5); txt_first_validation.Visible = false; txt_second_validation.Visible = true; txt_second_validation.Focus(); } catch { MessageBox.Show("Please try again !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } }
private void btn_login_Click(object sender, EventArgs e) { string userName = txtUsername.Text; string passWord = txtPassword.Text; Login login = new Login("", ""); string user = txtUsername.Text; string pass = txtPassword.Text; if (login.IsLoggedIn(user, pass)) { admin_menu form = new admin_menu(); form.Show(); this.WindowState = FormWindowState.Minimized; } else { MessageBox.Show("Log in failed please try again!"); } }