我使用的是vb.net,并且我有数据进入我的DGV,并且我有一个标记为已部署的列,如果它是'1',我希望将所有行部署列RED中的'1',如果它是'0',我希望所有行都是绿色的。这是我的方法,现在列是第10列,但它不喜欢=运算符。即使当我使用等于运算符的字符串1上的引号时。应该是一个整数,但我想尽一切办法,看看为什么它不工作。基于列值使DataGridView行变为特定颜色
Private Sub LaptopGrid_CellFormatting(ByVal Sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles LaptopGrid.CellFormatting
For i As Integer = 0 To LaptopGrid.Rows.Count - 1
If LaptopGrid.Rows(i).Cells(9).Value = 1 Then
LaptopGrid.RowsDefaultCellStyle.BackColor = Color.Green
End If
Next
End Sub