karthik
karthik

Reputation:

datagrid colorchange + c#

how to change the color of the selected cell in datagrid.im using .net 1.1,and i need it windows applns.

if i click the a cell in row no 2 then particular cell color should be changed

Upvotes: 0

Views: 250

Answers (1)

Sakkle
Sakkle

Reputation: 1944

I suspect what you are looking for in .NET 1.1 is something like this:

DataGridTest.Rows(1).Cells(1).Style.Backcolor = Color.Red

The .NET2 equivalent would be something like:

DataGridViewCellStyle MakeItGreen = new DataGridViewCellStyle;
MakeItGreen.BackColor = Color.Green;

DataGridViewRow row2 = myGrid.Rows(2);
row2.Cells(2).Style = MakeItGreen

Or simply:

this.myDataGridView[2,3].Style.BackColor = Color.Green;

If this is not what you were looking for please provide more information in your question...

Upvotes: 1

Related Questions