I have a datagridview that is populated with a couple of rows. I not sure where to start to loop the grid from row 1 to the last row and check some values on two of the columns. My grid looks like this, I need to check the values of r1:c1 and r1:c4 using a loop. my c1 is checkbox column by the way.
c1 c2 c3 c4 c5
r1 true 4 5 5 5
r2 false 4 5 5 5
r3 false 8 6 4 5
r4 false 5 1 2 3
r5 false 4 1 2 1
For Each row As DataGridViewRow In datagrid.Rows
If row.Cells("column1").Value = True Then
Dim getValue As String
getValue = row.Cells("column4").Value
This is what I'm using for the same purpose as you, but i'm checking for Strings/Integers so not sure how it would translate to boolean, and it works for returning a
value of column 4-row(i) when you check the
value of column 1-row(i). Hope this helps at least.
For i = 0 To YourDataGridHere.RowCount - 1 If Not (YourDataGridHere.Rows(i).Cells("Column1").Value = 0) Then MsgBox(YourDataGridHere.Rows(i).Cells("Column4").Value) End If Next