patrickstrijdonck
Programmer
Hi,
This is probarly something simple.....
Ive got a Datagridview which gives me all open calls in the table.
It got 7 Columns which the 7th is the State column containing the SLA Calculation (which is done in a query in Access)
It can have 3 values: "Overdue!", "Warning!", "OK!"
each row can have a different SLA State, What im trying to work is that when the form opens, C# checks all rows and change the backcolor of the specific cell with that value to a color,
Every cell with the value "Overdue!" must turn red etc etc
What ive got now, makes the whole Datagridview the color RED :S
Anything im missing here???
This is probarly something simple.....
Ive got a Datagridview which gives me all open calls in the table.
It got 7 Columns which the 7th is the State column containing the SLA Calculation (which is done in a query in Access)
It can have 3 values: "Overdue!", "Warning!", "OK!"
each row can have a different SLA State, What im trying to work is that when the form opens, C# checks all rows and change the backcolor of the specific cell with that value to a color,
Every cell with the value "Overdue!" must turn red etc etc
What ive got now, makes the whole Datagridview the color RED :S
Code:
int index = dataGridView1.RowCount;
for (int i = 1; i < index; i++)
{
DataGridViewCell cell = dataGridView1[7, i];
if (cell.Value.ToString() == "Overdue!")
{
e.CellStyle.BackColor = Color.Red;
}
else if (cell.Value.ToString() == "Warning!")
{
e.CellStyle.BackColor = Color.Orange;
}
}
Anything im missing here???