private void butdangnhap_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = @"select * from nguoidung where (tendangnhap=@tendangnhap) And (matkhau=@matkhau)"; cmd.Parameters.Add("@tendangnhap", SqlDbType.NVarChar, 50).Value = txtusername.Text; cmd.Parameters.Add("@matkhau", SqlDbType.NVarChar, 50).Value = txtpass.Text; da.SelectCommand = cmd; da.Fill(dt); if (dt.Rows.Count > 0) { Trangchu _trangchu = new Trangchu(); _trangchu.Show(); Hide(); } else { MessageBox.Show("Bạn sai tài khoản hoặc quên mật khẩu", "đăng nhập", MessageBoxButtons.OK); } }
private void tsbhome_Click(object sender, EventArgs e) { Trangchu tc = new Trangchu(); tc.Show(); this.Close(); }
private void toolStripButton1_Click(object sender, EventArgs e) { Trangchu tc = new Trangchu(); tc.ShowDialog(); this.Hide(); }
private void tsbhome_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có muốn về trang chủ không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { Dispose(); } Trangchu tc = new Trangchu(); tc.ShowDialog(); }
private void toolStripButton1_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có muốn thoát?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { Dispose(); } Trangchu tc = new Trangchu(); tc.Show(); this.Hide(); }
private void tsbthoat_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Bạn có muốn thoát không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Dispose(); } Trangchu tc = new Trangchu(); tc.Show(); this.Hide(); }