Change Datagridview Row Color based on Cell Value with

Good Morning! It has been a busy couple days but I will update you later in the day once I get the girls off to school. For now, nothing exciting but I needed to change the row color of a datagridview row based on a cell value. Nothing complicated but it was what I needed to do yesterday. Make it a great day!

For Each row As DataGridViewRow In Me.DataGridView1.Rows
            If Not row.IsNewRow Then
                If Not row.Cells(1).Value Is DBNull.Value Then
                    If row.Cells(1).Value Is "Yes" Then
                        row.DefaultCellStyle.BackColor = Color.Red
                    End If
                End If
            End If

Technorati Tags: ,,,,,,,,,,,,

Windows Live Tags:,.NET Framework,csharp,row,Change,Datagridview,Color,Cell,Value,DBNull,DefaultCellStyle,BackColor,Cells


  1. #1 by Eugenia on March 8, 2010 - 4:55 pm

    nothing happens with that code :S

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: