>> 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 >>>
>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