Solved

VB.net DataGridView rows alternating colors

Posted on 2012-03-26
3
769 Views
Last Modified: 2012-03-30
Hi

What is the best way to color the alternating rows of a  DataGridView in two different colors.

Thanks
0
Comment
Question by:murbro
3 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 250 total points
Comment Utility
You set the styles at runtime or at design time:

With Me.DataGridView1
    .RowsDefaultCellStyle.BackColor = Color.White
    .AlternatingRowsDefaultCellStyle.BackColor = Color.Gainsboro
End With

Open in new window

0
 
LVL 14

Assisted Solution

by:athomsfere
athomsfere earned 250 total points
Comment Utility
In the properties window of the DataGridView you should also see the property for AlternatingRowsDefaultCellStyle.

Edit it there.
0
 

Author Closing Comment

by:murbro
Comment Utility
thanks very much
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now