private void dgvDanhSachQL_CellContentClick(object sender, DataGridViewCellEventArgs e) { int col = e.ColumnIndex; int row = e.RowIndex; if (dgvDanhSachQL.Columns[col] is DataGridViewButtonColumn && dgvDanhSachQL.Columns[col].Name == "delete") { if (row >= 0 && row < dgvDanhSachQL.Rows.Count) { cng.Del(row, cng.memberTable); } } }
private void dgvDanhSach_CellContentClick(object sender, DataGridViewCellEventArgs e) //pass { int col = e.ColumnIndex; int row = e.RowIndex; if (dgvDanhSach.Columns[col] is DataGridViewButtonColumn && dgvDanhSach.Columns[col].Name == "delete") { if (row >= 0 && row < dgvDanhSach.Rows.Count) { DialogResult result = MessageBox.Show("Bạn Có muốn xóa", "Xóa", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { cng.Del(row, cng.memberTable); } } } cng.Update(cng.memberTable); }