Check/Uncheck a checkbox on datagridview

前端 未结 16 695
野性不改
野性不改 2020-11-30 11:19

Can someone help me why it doesn\'t work? I have a checkbox and if I click on it, this should uncheck all the checkbox inside the datagridview which were check

16条回答
  •  一生所求
    2020-11-30 11:40

    that worked for me after clearing selection, BeginEdit and change the girdview rows and end the Edit Mode.

     if (dgvDetails.RowCount > 0)
                        {
                            dgvDetails.ClearSelection(); 
                            dgvDetails.BeginEdit(true); 
                          
                            foreach (DataGridViewRow dgvr in dgvDetails.Rows)
                            {
                                dgvr.Cells["cellName"].Value = true;
                            }
                            dgvDetails.EndEdit();
                        }
    

提交回复
热议问题