private void button1_Click(object sender, EventArgs e) { if (txttaikhoan.Text == "admin" && txtmatkhau.Text == "admin") { BTLon_KSan.Form1 fm = new BTLon_KSan.Form1(); fm.FormClosing += fm_FormClosing; fm.Show(); this.Hide(); } else { MessageBox.Show("Không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void txtmatkhau_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txttaikhoan.Text == "admin" && txtmatkhau.Text == "admin") { BTLon_KSan.Form1 fm = new BTLon_KSan.Form1(); fm.FormClosing += fm_FormClosing; fm.Show(); this.Hide(); } else { MessageBox.Show("Không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } }