程序代码:
Rem 如你的图,只有4列可以这么写。
Private Sub DataGridView1_CellEndEdit(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
Dim thisCol As Integer = 3
Try
If e.ColumnIndex = thisCol And DataGridView1.Rows(e.RowIndex).Cells(2).Value > 5 Then
DataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Red
Else
DataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
End If
Catch ex As Exception
End Try
End Sub[此贴子已经被作者于2017-10-12 20:30编辑过]







