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 ..

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

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


DataGridView1.CurrentCell.Style.BackColor = Color
DataGridView1.CurrentCell.Style.ForeColor = Color