public void HienThiComboBox(String lop, String monHoc, ComboBoxEx comboBox) { LoaiDiemData m_LoaiDiemData = new LoaiDiemData(); comboBox.DataSource = m_LoaiDiemData.LayDsLoaiDiem(lop, monHoc); comboBox.DisplayMember = "TenLoaiKT"; comboBox.ValueMember = "MaLoaiKT"; }
private void frmXemDiem_Load(object sender, EventArgs e) { m_NamHocCtrl.HienThiComboBox(cmbNamHocSD); DataTable m_DT1 = m_LoaiDiemData.LayDsLoaiDiem(); DataTable m_DT2 = m_DiemData.LayDsDiem1(); foreach (DataRow rowDiem1 in m_DT2.Rows) { if (rowDiem1["MaLoaiKT"].ToString() == "LD001") { dGVDiem.Columns.Add("colDiem1", rowDiem1["TenLoaiKT"].ToString()); } if (rowDiem1["MaLoaiKT"].ToString() == "LD002") { dGVDiem.Columns.Add("colDiem2", rowDiem1["TenLoaiKT"].ToString()); } if (rowDiem1["MaLoaiKT"].ToString() == "LD003") { dGVDiem.Columns.Add("colDiem3", rowDiem1["TenLoaiKT"].ToString()); } if (rowDiem1["MaLoaiKT"].ToString() == "LD004") { dGVDiem.Columns.Add("colDiem4", rowDiem1["TenLoaiKT"].ToString()); } if (rowDiem1["MaLoaiKT"].ToString() == "LD005") { dGVDiem.Columns.Add("colDiem5", rowDiem1["TenLoaiKT"].ToString()); } if (rowDiem1["MaLoaiKT"].ToString() == "LD006") { dGVDiem.Columns.Add("colDiem6", rowDiem1["TenLoaiKT"].ToString()); } } }
//Hien thi ComboBox public void HienThiComboBox(ComboBoxEx comboBox) { comboBox.DataSource = m_LoaiDiemData.LayDsLoaiDiem(); comboBox.DisplayMember = "TenLoai"; comboBox.ValueMember = "MaLoai"; }