Пример #1
0
 void LoadDataTimKiem()
 {
     try
     {
         dtXe = new DataTable();
         dtXe.Clear();
         DataSet ds = dbXe.Timkiem(txtTimKiem.Text);
         dtXe = ds.Tables[0];
         // Đưa dữ liệu lên DataGridView
         dgvXe.DataSource = dtXe;
         // Thay đổi độ rộng cột
         dgvXe.AutoResizeColumns();
         // Xóa trống các đối tượng trong Panel
         this.txtMaXe.ResetText();
         this.txtTenXe.ResetText();
         this.txtGiaXe.ResetText();
         this.cboMauSac.ResetText();
         this.txtSoLuong.ResetText();
         // Không cho thao tác trên các nút Lưu / Hủy
         this.btnLuu.Enabled = false;
         this.btnHuy.Enabled = false;
         this.pnlXe.Enabled  = false;
         // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát
         this.btnThem.Enabled   = true;
         this.btnSua.Enabled    = true;
         this.btnXoa.Enabled    = true;
         this.btnThoat.Enabled  = true;
         SHAREVAR.search_maxe   = false;
         SHAREVAR.search_tenxe  = false;
         SHAREVAR.search_mausac = false;
         ////
         dgvXe_CellClick(null, null);
     }
     catch
     {
         MessageBox.Show("Không lấy được nội dung trong table Xe. Lỗi rồi!!!");
     }
 }
Пример #2
0
 void LoadDataTimKiem()
 {
     try
     {
         dtXe = new DataTable();
         dtXe.Clear();
         DataSet ds = dbXe.Timkiem(txtTimKiem.Text);
         dtXe = ds.Tables[0];
         // Đưa dữ liệu lên DataGridView
         dgvXe.DataSource = dtXe;
         // Thay đổi độ rộng cột
         dgvXe.AutoResizeColumns();
         SHAREVAR.search_maxe   = false;
         SHAREVAR.search_tenxe  = false;
         SHAREVAR.search_mausac = false;
         ////
         dgvXe_CellClick(null, null);
     }
     catch
     {
         MessageBox.Show("Không lấy được nội dung trong table Xe. Lỗi rồi!!!");
     }
 }