private void button4_Click(object sender, EventArgs e) { this.Hide(); mainpage mm = new mainpage(); mm.Show(); }
private void button1_Click(object sender, EventArgs e) { try { if (txtuser.Text == "" || txtpss.Text == "") { MessageBox.Show("Plese FIll The Empty Fields"); } else { //get data string uname = txtuser.Text; string pass = txtpss.Text; //step 2: prepare stmt and cmd string stmt = "SELECT COUNT(*) from tbl_Users where UserName='******' and Password='******'"; SqlCommand cmd = new SqlCommand(stmt, con); //step3: open the con con.Open(); // step 4: exec cmd int x = (int)cmd.ExecuteScalar(); // step 5: close con con.Close(); if (x == 1) { mainpage main = new mainpage(); this.Hide(); main.Show(); } else if (x == 0) { MessageBox.Show("Invalid username or password"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnexit_Click(object sender, EventArgs e) { mainpage m = new mainpage(); m.Show(); }
private void operationFormsToolStripMenuItem_Click(object sender, EventArgs e) { mainpage nn = new mainpage(); nn.Show(); }