private void MU_Home_Click(object sender, EventArgs e) { HomeForm home = new HomeForm(); home.Show(); this.Hide(); }
private void loginButton_Click(object sender, EventArgs e) { con.Open(); SqlDataAdapter sda = new SqlDataAdapter("SELECT Count(*) FROM UserTbl WHERE username = '******' and password = '******'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { HomeForm home = new HomeForm(); home.Show(); this.Hide(); } else { MessageBox.Show("Invalid Credentials"); } con.Close(); }