Mehmet Fatih

Mehmet Fatih

  • 852
  • 939
  • 40.9k

Count the number of checked checkboxes

Aug 8 2023 5:24 PM

I want to get the number of checked checkboxes. I tried to do it with the codes below, but I could not succeed..

          int count = 0;
           
  for (count = 0; count <= dataGridView1.RowCount; count++)
                {
                if (Convert.ToBoolean(dataGridView1.Rows[count].Cells[0].Value) == true)
                {
              
                  count++;
                    label6.Text = (count.ToString());
                }
            }

 


Answers (4)