Reputation: 7819
I am sure almost that it's very easy but I can't find how...
I have DataGridViewCheckBoxColumn
and I need to update all cell values in this column like below:
private void HCStaffSelect_OnCheckBoxClicked(bool isChecked)
{
foreach (DataGridViewRow row in dgvStaffs.Rows)
{
if (!row.IsNewRow)
{
row.Cells[cStaffSelect.Index].Value = isChecked;
}
}
}
My problem is that focused (selected) cell doesn't change its value. How to change value so cells too?
Upvotes: 0
Views: 871
Reputation: 22896
DataGridView.RefreshEdit()
can be used to refresh the value of the curenly editing cell:
for (int r = 0; r < dgvStaffs.RowCount - 1; r++)
dgvStaffs[cStaffSelect.Index, r].Value = isChecked;
dgvStaffs.RefreshEdit();
Upvotes: 1