private void login_Activated(object sender, EventArgs e) { if (Windows.RememberUser()) { new UserChecker().Show(); Hide(); } Uname.Focus(); }
private void Password_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { LogIn.PerformClick(); Uname.Text = ""; password.Text = ""; Uname.Focus(); } }
private void Button1_Click_1(object sender, EventArgs e) { try { using (SqlConnection con = new SqlConnection(Properties.Settings.Default.conString)) { using (SqlCommand cmd = new SqlCommand("SELECT UserName, Password FROM t_register WHERE UserName = '******'" + "AND Password='******' ")) { cmd.CommandType = CommandType.Text; cmd.Connection = con; con.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { sdr.Read(); string use = sdr["UserName"].ToString(); String paw = sdr["Password"].ToString(); if (use == Uname.Text.ToString() && paw == password.Text.ToString()) { MessageBox.Show("Success !!"); this.Hide(); sAoPage ss = new sAoPage(); ss.Show(); } } con.Close(); } } } catch (Exception) { MessageBox.Show("Invalid User Name / Password"); } Uname.Text = ""; password.Text = ""; Uname.Focus(); }