PC Review

Thread Tools Rate Thread

DataGridView change row color

Tony B
Posts: n/a
      19th Apr 2006
I'm trying to change the background color of a row in a DataGridView
based upon a value in one of the row columns

For i As Integer = 0 To myDataGridView.Rows.Count - 1
If CInt(myDataGridView.Rows(i).Cells(12).Value) = 2 Then

myDataGridView.Rows(i).DefaultCellStyle.BackColor = Color.Red

End If

I've stepped through the code so I know that the value of cell 12 is
being pulled out and the line
myDataGridView.Rows(i).DefaultCellStyle.BackColor = Color.Red
is executed but the background color isn't changed.

Any suggestions?

Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
color transition (color changes from dark color to light color) color transition Microsoft Powerpoint 2 21st Nov 2009 01:21 PM
Change color of DataGridView row (BackColor) Lloyd Sheen Microsoft VB .NET 1 2nd Jan 2009 05:40 PM
datagridview change CELL BG color on change of value =?Utf-8?B?QnJpYW5ESA==?= Microsoft C# .NET 1 9th Sep 2008 02:25 AM
DataGridView row background color =?Utf-8?B?bWFydGluMQ==?= Microsoft VB .NET 6 28th Jun 2006 05:33 PM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Microsoft Excel Programming 1 5th Mar 2004 10:10 AM




All times are GMT +1. The time now is 11:57 AM.