public frmChonNamHoc() { InitializeComponent(); oBNamHoc = new cBDM_NamHoc(); pNamHocInfo = new DM_NamHocInfo(); DataTable dtNamHoc = new DataTable(); dtNamHoc = oBNamHoc.Get(pNamHocInfo); cmbNamHoc.Properties.ValueMember = "DM_NamHocID"; cmbNamHoc.Properties.DisplayMember = "TenNamHoc"; cmbNamHoc.Properties.DataSource = dtNamHoc; if (dtNamHoc != null) { cmbNamHoc.EditValue = dtNamHoc.Rows[0]["DM_NamHocID"]; } DataTable dt = new DataTable(); dt.Columns.Add("HocKy", typeof(int)); DataRow dr = dt.NewRow(); dr["HocKy"] = 1; dt.Rows.Add(dr); dr = dt.NewRow(); dr["HocKy"] = 2; dt.Rows.Add(dr); cmbHocKy.Properties.ValueMember = "HocKy"; cmbHocKy.Properties.DisplayMember = "HocKy"; cmbHocKy.Properties.DataSource = dt; cmbHocKy.EditValue = dt.Rows[0]["HocKy"]; }
private void frmBienLaiThuTien_Load(object sender, EventArgs e) { bar1.Visible = true; grdSoPhieu.DataSource = oBTC_BienLaiThuTien.GetNamHoc(Program.IDNamHoc, Program.HocKy); if (grdSoPhieu.DataSource != null && grvSoPhieu.DataRowCount > 0) { grvSoPhieu_FocusedRowChanged(null, null); } cmbNamHoc.Properties.DataSource = oBNamHoc.Get(pNamHocInfo); cmbNamHoc.EditValue = Program.IDNamHoc; DataTable dt = new DataTable(); dt.Columns.Add("HocKy"); DataRow dr = dt.NewRow(); dr["HocKy"] = 1; dt.Rows.Add(dr); dr = dt.NewRow(); dr["HocKy"] = 2; dt.Rows.Add(dr); cmbHocKy.Properties.DataSource = dt; cmbHocKy.EditValue = Program.HocKy.ToString();; cmbLop.Properties.DataSource = oBDM_Lop.GetDanhSachLop(new DM_LopInfo(), Program.NamHoc); }