> private void dataGridViewTrackingSearch_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) > { > if (dataGridViewTrackingSearch.Columns[e.ColumnIndex].Name.Equals("ColumnHasComment")) > { > if (e.Value != null) > { > > if (e.Value.ToString() == "Y") > { > e.CellStyle.BackColor = Color.Red; > e.CellStyle.SelectionBackColor = Color.DarkRed; > } > } > } > } // end CellFormatting >I may not be understanding your question so I appologize ahead of time. I would think you could just do something such as this.
private void grdMembers_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value != null) { string colName = grdMembers.Columns[e.ColumnIndex].Name; if (e.Value.ToString() == "Y") { switch (colName) { case "ColumnHasComment": e.CellStyle.BackColor = Color.Red; e.CellStyle.SelectionBackColor = Color.DarkRed; break; case "ColumnSono" : e.CellStyle.BackColor = Color.Blue; e.CellStyle.SelectionBackColor = Color.Beige; break; } } } }Tim