private void loadVTPT_Ton_Vao_GridView() { List <VatTuPhuTungDTO> listVatTuPhuTung = vtptBus.select_ton(); if (listVatTuPhuTung == null) { MessageBox.Show("Có lỗi khi lấy DB"); return; } data_ton.Columns.Clear(); data_ton.DataSource = null; data_ton.AutoGenerateColumns = false; data_ton.AllowUserToAddRows = false; data_ton.DataSource = listVatTuPhuTung; DataGridViewTextBoxColumn clMa = new DataGridViewTextBoxColumn(); clMa.Name = "Mavtpt"; clMa.HeaderText = "Mã VTPT"; clMa.DataPropertyName = "Maloaivattu"; data_ton.Columns.Add(clMa); DataGridViewTextBoxColumn clTen = new DataGridViewTextBoxColumn(); clTen.Name = "Tenvtpt"; clTen.HeaderText = "Tên VTPT"; clTen.DataPropertyName = "Tenloaivattu"; data_ton.Columns.Add(clTen); DataGridViewTextBoxColumn clTon = new DataGridViewTextBoxColumn(); clTon.Name = "Soluongton"; clTon.HeaderText = "Số lượng tồn"; clTon.DataPropertyName = "Soluongton"; data_ton.Columns.Add(clTon); CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[data_ton.DataSource]; myCurrencyManager.Refresh(); }