S sameerd74 Mar 24, 2007 #1 I have a DataGrid with 3 Columns. I want to change Cell text color of only first Column. How I do that? Thanks!
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 Mar 24, 2007 #2 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.
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.
C ClayB Mar 25, 2007 #3 If you need to work with a Windows Forms DataGrid, then it is more work to color a column. Here is a MSDN article and FAQ entry that discusses this. http://msdn2.microsoft.com/en-us/library/ms996485.aspx http://www.syncfusion.com/faq/windowsforms/search/745.aspx ================== Clay Burch Syncfusion, Inc.
If you need to work with a Windows Forms DataGrid, then it is more work to color a column. Here is a MSDN article and FAQ entry that discusses this. http://msdn2.microsoft.com/en-us/library/ms996485.aspx http://www.syncfusion.com/faq/windowsforms/search/745.aspx ================== Clay Burch Syncfusion, Inc.