Check/Uncheck a checkbox on datagridview

前端 未结 16 705
野性不改
野性不改 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条回答
  •  萌比男神i
    2020-11-30 11:40

    All of the casting causes errors, nothing here I tried worked, so I fiddled around and got this to work.

      foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[0].Value != null && (bool)row.Cells[0].Value)
                {
                    Console.WriteLine(row.Cells[0].Value);
                }
    
            }
    

提交回复
热议问题