Solved

VB.net DataGridView rows alternating colors

Posted on 2012-03-26
3
773 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
ID: 37766381
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
ID: 37766424
In the properties window of the DataGridView you should also see the property for AlternatingRowsDefaultCellStyle.

Edit it there.
0
 

Author Closing Comment

by:murbro
ID: 37786461
thanks very much
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
send messages to whatsapp programatically 2 67
VB.Net - MemoryMappedFiles - Confirm receipt 2 25
Help with error in Query 2 31
Data organization issue 7 20
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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