Exemple #1
0
        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
            FormGV gv = new FormGV(lbtengv.Text);

            gv.Show();
        }
        private void btndnhap_Click(object sender, EventArgs e)
        {
            DataTable dt = myCB.Login(txttendn.Text, txtmk.Text, cboloaitk.Text);

            if (dt.Rows[0][0].ToString() == "1")
            {
                if (cboloaitk.Text == "admin")
                {
                    this.Hide();
                    FormAdmin main = new FormAdmin();
                    main.Show();
                }
                else
                {
                    this.Hide();
                    FormGV maingv = new FormGV(txttendn.Text);
                    maingv.Show();
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Đăng nhập không thành công", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                if (result == DialogResult.OK)
                {
                    txttendn.Text = "";
                    txtmk.Text    = "";
                }
                else if (result == DialogResult.Cancel)
                {
                }
            }
        }