Exemplo n.º 1
0
        private void dgvSinhVien_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;

            txtMaSV.Text      = dgvSinhVien.Rows[index].Cells["MaSinhVien"].Value.ToString();
            txtHoTen.Text     = dgvSinhVien.Rows[index].Cells["HoTen"].Value.ToString();
            dtpNgaySinh.Value = DateTime.Parse(dgvSinhVien.Rows[index].Cells["NgaySinh"].Value.ToString());
            string gioiTinh = dgvSinhVien.Rows[index].Cells["GioiTinh"].Value.ToString();

            if (gioiTinh == "Nam")
            {
                radNam.Checked = true;
            }
            else
            {
                radNu.Checked = true;
            }

            string  maLop    = dgvSinhVien.Rows[index].Cells["MaLop"].Value.ToString();
            KhoaBUL khoaBUL  = new KhoaBUL();
            Khoa    khoainfo = khoaBUL.TimKhoaTheoLop(maLop);

            cboKhoa.SelectedValue = khoainfo.MaKhoa;

            cboLop.SelectedValue = maLop;

            btnSua.Enabled  = true;
            btnXoa.Enabled  = true;
            btnThem.Enabled = false;
            btnTim.Enabled  = false;
            txtMaSV.Enabled = false;
        }
Exemplo n.º 2
0
        private void ShowComboBoxKhoa()
        {
            KhoaBUL     khoaBUL = new KhoaBUL();
            List <Khoa> dsKhoa  = khoaBUL.DanhSach();

            cboKhoa.DataSource    = dsKhoa;
            cboKhoa.DisplayMember = "TenKhoa";
            cboKhoa.ValueMember   = "MaKhoa";
        }
Exemplo n.º 3
0
        private void FrmSinhVien_Load(object sender, EventArgs e)
        {
            rdNam.Checked          = true;
            listSV                 = SinhVienBUL.LoadSinhVien();
            dgvSinhVien.DataSource = listSV;

            cboKhoa.DataSource    = KhoaBUL.LoadKhoa();
            cboKhoa.ValueMember   = "MaKhoa";
            cboKhoa.DisplayMember = "TenKhoa";
            cleanData();
            SetDoRong();
        }