private void dgvUmat_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (dgvUmat.Rows.Count > 0) { if (dgvUmat.IsCurrentCellDirty == false) { if (cellEdit != (bool)dgvUmat.CurrentRow.Cells[9].Value) { if (dgvUmat.CurrentRow.Cells[9].Value.Equals(true)) { hadir = "1"; pdTotal = pdTotal + 1; } else { hadir = "0"; pdTotal = pdTotal - 1; } lbltotal.Text = "Total Jemaat : " + Convert.ToString(pdTotal); pd.updateTotal(headerId, Convert.ToString(pdTotal)); pd.editLines(dgvUmat.CurrentRow.Cells[0].Value.ToString(), hadir); } } else { cellEdit = (bool)dgvUmat.CurrentRow.Cells[9].Value; } } }