Windows Form DataGrid Contol, Cell text color problem

  • Thread starter Thread starter sameerd74
  • Start date Start date
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!
 
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.
 
Back
Top