我很难搞清楚这一点。我有2个DataGridViews,我需要比较每个列的1列并突出显示重复项。我从SQL数据库填充DataGrids。我到目前为止的代码如下。所有这一切都突出了每一行。我不确定如何让它查看列并找到任何重复的值,而不只是在同一行号。
Dim RowOut As Integer
Dim RowIn As Integer
For Each rowOuter As DataGridViewRow In listOrderGrid.Rows
For Each rowInner As DataGridViewRow In listWebPollingGrid.Rows
RowOut = rowOuter.Cells("OrderID").Value
RowIn = rowInner.Cells("OrderID").Value
If rowInner.Cells("OrderID").Value = rowOuter.Cells("OrderID").Value Then
rowOuter.DefaultCellStyle.BackColor = Color.LightGreen
rowInner.DefaultCellStyle.BackColor = Color.LightGreen
End If
If rowOuter.Cells("OrderTypeName").Value = "Paid Out" Then
rowOuter.DefaultCellStyle.BackColor = Color.Violet
End If
Next
Next