Here's my code..
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// Column is 'sold'
// Looking to change all unsold vehicles to red
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "sold")
{
if (e.Value != null)
{
string stringValue = (string)e.Value;
stringValue = stringValue.ToLower();
if (stringValue == "No")
{
e.CellStyle.BackColor = Color.Red;
}
}
}
}
For info, I've tried changing the if statement to all variations of sold.. for example, _sold/Sold/sold. Still not working =(

New Topic/Question
Reply



MultiQuote




|