private void metroButton1_Click(object sender, EventArgs e) { try { if (Txt_Uname.Text.Length > 0) { errorProvider1.Clear(); username = Txt_Uname.Text; } else { errorProvider1.SetError(Txt_Uname, "Username is required"); } if (Txt_Pname.Text.Length > 3) { errorProvider2.Clear(); password = Txt_Pname.Text; } else if (Txt_Pname.Text.Length == 0) { errorProvider2.SetError(Txt_Pname, "Password is required"); } //else if (metroTextBox4.Text.Length < 7) //{ // errorProvider2.SetError(metroTextBox4, "Password must contain more than 7 characters"); //} //username = metroTextBox3.Text; //password = metroTextBox4.Text; String query1 = ("select * from Login_Table where User_Name='" + username + "'and Password='******'"); DataTable dt = db.GetData(query1); if (dt.Rows.Count > 0) { Main_Menu mn = new Main_Menu(); mn.Show(); Hide(); } else { MessageBox.Show("Invalid Login please check your username and password"); } } catch (Exception) { MessageBox.Show("Exception"); } }
private void metroButton3_Click(object sender, EventArgs e) { Main_Menu mn = new Main_Menu(); mn.Show(); Close(); }
private void Exit_Click(object sender, EventArgs e) { Main_Menu mn = new Main_Menu(); mn.Show(); Close(); }