Windows Form DataGrid Contol, Cell text color problem

S

sameerd74

I have a DataGrid with 3 Columns.

I want to change Cell text color of only first Column. How I do that?

Thanks!
 
B

Ben Rush

this.dataGridView1.Columns.Add("first", "first");
this.dataGridView1.Columns.Add("second", "second");
this.dataGridView1.Columns.Add("third", "third");

this.dataGridView1.Columns[0].DefaultCellStyle.ForeColor = Color.Red;
this.dataGridView1.Rows.Add(new Object[] { "first item", "second item",
"third item" });

If you've got your columns being databound, you won't manually create them
as I did, but you can still get at the first column and set the forecolor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top