
Originally Posted by
.paul.
Code:
Dim found As Boolean = False
For Each row As DataGridViewRow In Me.LotsDataGridView.Rows
For Each c As DataGridViewCell In row.Cells
If c.Style.BackColor = Color.Red Then found = True
Next
Next
If found Then
MessageBox.Show("found red cell")
End If
Another option that will terminate the loops once the first red cell is found:
Code:
Dim found As Boolean = False
For Each row As DataGridViewRow In Me.LotsDataGridView.Rows
For Each c As DataGridViewCell In row.Cells
If c.Style.BackColor = Color.Red Then
found = True
MessageBox.Show("found red cell")
Exit For
End If
Next
If found = True Then
Exit For
End If
Next