i'm developing an Accounting Program. You all know about "type of ledger" in Accounting and when i viewed all my ledger in a datagrid, i added the ledger classification.
This started confusing me how to coloring the rows which show the ledger different with the row Color which show the classification.

I used to call DataGridTableStyles and use the property "BackColor" but we know it colors only the odd-numbered rows. I had hard seeking suitable methods and properties and finally conclude myself that perhaps it means unavailable. Anyone please help me solve this with tells the methods or even the code if there's no method available ..

example:
Row Color
1 Red
2 Green
3 Blue
4 Blue
5 Green
6 Blue
7 Red
8 Green
etc

thanks and regards

Vincentius Owen

try this

Use the "Style" property -

DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color
DataGridView1.Item(ColumnIndex, RowIndex).Style.ForeColor = Color

or

DataGridView1.CurrentCell.Style.BackColor = Color
DataGridView1.CurrentCell.Style.ForeColor = Color
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.