Help with changing rows backcolor

Hi,

How do you change rows backcolor if after column 3, data in remaining rows are identical, using vb.net?

Thanks

Victor
vcharlesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karrtik IyerSoftware ArchitectCommented:
Hi Victor, is this for a data grid control in VB.NET that you are talking about?
Please specify for which control are you looking to change the back color.

Thanks and regards,
Karrtik
0
CodeCruiserCommented:
Something like below (untested)

For i As Integer = 0 to dgv.Rows.Count - 1
   If i < dgv.Rows.Count - 2 Then
      if dgv.Rows(i).Cells(3).Value = dgv.Rows(i+1).Cells(3).Value AND dgv.Rows(i).Cells(4).Value = dgv.Rows(i+1).Cells(4).Value AND ... Then
         dgv.Rows(i).DefaultCellStyle.BackColor = Color.Red
         dgv.Rows(i+1).DefaultCellStyle.BackColor = Color.Red
      End If
   End If
Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vcharlesAuthor Commented:
Hi,

Thanks for the comments, it is the datagridview that comes with VS2010.
0
CodeCruiserCommented:
Have you tried the code provided above?
0
vcharlesAuthor Commented:
Hi,

I did not try it yet, will reply this week.

Thanks,

V.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.