flynn Posted September 6, 2006 Posted September 6, 2006 I am wanting to change the backcolor of a specific row/cell in a DataGridView control using the following code: private void CustomGridCellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (dgSearchResults.Columns[e.ColumnIndex].Name.Equals("column1")) { // Ensure that the value is a string. String stringValue = e.Value as string; if (stringValue == null) return; switch (stringValue) { case "G": e.CellStyle.BackColor = Color.Gold; break; case "S": e.CellStyle.BackColor = Color.Silver; break; case "N": break; } } } This delegate gets called but the backcolor doesn't change. Am I missing something? tia, flynn Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.