private void btnThongke_Click(object sender, EventArgs e) { dgvDanhSach.DataSource = SachBUS.DanhSachSach(); Custom(); dgvDanhSach.ClearSelection(); for (int i = 0; i < dgvDanhSach.RowCount; i++) { DataGridViewCellStyle style = new DataGridViewCellStyle(); style.BackColor = Color.Yellow; if (int.Parse(dgvDanhSach.Rows[i].Cells[2].Value.ToString()) <= 10) { dgvDanhSach.Rows[i].DefaultCellStyle = style; } } }
void LoadData() { tsbtnXoa.Enabled = false; tsbtnSua.Enabled = false; dgvDanhSach.DataSource = SachBUS.DanhSachSach(); Custom(); dgvDanhSach.ClearSelection(); for (int i = 0; i < dgvDanhSach.RowCount; i++) { DataGridViewCellStyle style = new DataGridViewCellStyle(); style.BackColor = Color.Yellow; if (int.Parse(dgvDanhSach.Rows[i].Cells[5].Value.ToString()) <= 10) { dgvDanhSach.Rows[i].DefaultCellStyle = style; } } }