Gary
Gary

Reputation: 33

How to color code paired entries in a datagridview?

I have a datagridview where every two rows are part of a pair and I would like to keep paired rows the same color for easier reading.

How can I do this when adding new rows programmatically? Thanks

Upvotes: 0

Views: 63

Answers (1)

pensum
pensum

Reputation: 1019

You need to add attributes to your datagridview tag.

this.dataGridView.RowsDefaultCellStyle.BackColor = Color.Black;
this.dataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.Yellow;

Upvotes: 0

Related Questions