void LoadData() { try { dtMonHoc = new DataTable(); dtMonHoc.Clear(); DataSet ds = dbMH.LayMonHoc(); dtMonHoc = ds.Tables[0]; gcMonHoc.DataSource = dtMonHoc; dtGiangVien = new DataTable(); dtGiangVien.Clear(); DataSet dsGV = dbGV.LayGiangVien(); dtGiangVien = dsGV.Tables[0]; lookUpMaGV.Properties.DataSource = dtGiangVien; lookUpMaGV.Properties.DisplayMember = "MaGV"; lookUpMaGV.Properties.ValueMember = "MaGV"; this.txtMaMH.ResetText(); this.txtTenMH.ResetText(); this.spinSoTC.ResetText(); this.lookUpMaGV.ResetText(); this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.layoutControl1.Enabled = false; this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnTroVe.Enabled = true; gvMonHoc_RowCellClick(null, null); } catch (SqlException) { XtraMessageBox.Show("Không lấy được nội dung trong table THANHPHO. Lỗi rồi!!!"); } }
void LoadData() { try { dtGiangVien = new DataTable(); dtGiangVien.Clear(); DataSet ds = dbGV.LayGiangVien(); dtGiangVien = ds.Tables[0]; gcGiangVien.DataSource = dtGiangVien; this.txtMaGV.ResetText(); this.txtTenGV.ResetText(); this.rdoNam.ResetText(); this.rdoNu.ResetText(); this.txtDiaChi.ResetText(); this.txtDienThoai.ResetText(); this.txtEmail.ResetText(); this.picHinhGV.Image = null; this.picHinhGV.BackgroundImage = null; this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.layoutControl1.Enabled = false; this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnTroVe.Enabled = true; gvGiangVien_RowCellClick(null, null); } catch (SqlException) { XtraMessageBox.Show("Không lấy được nội dung trong table THANHPHO. Lỗi rồi!!!"); } }