示例#1
0
 private void LoadDataDM()
 {
     try
     {
         dataTable = new DataTable();
         dataTable.Clear();
         DataSet ds = BTLTA.LayLoaiThucAn();
         dataTable = ds.Tables[0];
         // đưa dữ liệu vào dataGridView
         dgvDanhMuc.DataSource = dataTable;
     }
     catch (Exception errr)
     {
         MessageBox.Show(errr.Message);
     }
     txtTenDM.ResetText();
     txtIDDM.ResetText();
     // không cho thao tác trên các nút lưu/hủy
     btnThemDM.Enabled = true;
     btnLuuDM.Enabled  = false;
     btnXemDM.Enabled  = true;
     btnXoaDM.Enabled  = true;
     btnSuaDM.Enabled  = true;
     dgvDanhMuc_CellClick(null, null);
 }
示例#2
0
 private void LoadCategory()
 {
     //Load dữ liệu combobox
     cmbdanhmucmonan.DataSource    = loaita.LayLoaiThucAn().Tables[0];
     cmbdanhmucmonan.DisplayMember = "TenLoaiThucAn";
 }