vb.net 根据内容设置DataGridView行背景色

 ''设置特殊行背景色
    Private Sub DataGridView1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
        If Me.DataGridView1.Columns(e.ColumnIndex).Name = "备注" Then
            If e.Value IsNot Nothing Then
                If e.Value = "黑名单" Then
                    Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.YellowGreen
                End If
            End If
        End If
    End Sub
posted @ 2009-04-01 21:10  Wind·e  阅读(1502)  评论(0编辑  收藏  举报