我需要更改datagridview中行的颜色,但我的代码不适合我。 我总是写着一个错误“列命名数量:无法找到参数名称:列名”根据单元格的数量更改DataGridView中的行颜色
这里是我的代码:
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1
If Me.DataGridView1.Rows(i).Cells("Quantity:").Value < 5 Then
Me.DataGridView1.Rows(i).Cells("Quantity:").Style.ForeColor = Color.Red
End If
Next
End Sub
请帮我解决这个问题。谢谢。
使用我的以下回答链接进行日期范围比较 http://stackoverflow.com/a/29486288/3583859 –