private void dgvCourse_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (string.Compare(dgvCourse.CurrentCell.OwningColumn.Name, "active") == 0) { bool checkBoxStatus = Convert.ToBoolean(dgvCourse.CurrentCell.EditedFormattedValue); if (checkBoxStatus) { int id = Convert.ToInt32(dgvCourse.CurrentRow.Cells[0].Value); courseDAO.reactive(id); } else { int id = Convert.ToInt32(dgvCourse.CurrentRow.Cells[0].Value); courseDAO.delete(id); } } }