I tried to change the backcolor in a specific column when the cell value changed. I didn't find the method to do that and I don't know how to do that.
ok ----> backcolor in green.
nok ----> backcolor in red.
thank you very much for your help.
private void timer2_Tick(object sender, EventArgs e)
{
int count = 0;
foreach (DataRow dr in ds.Tables[0].Rows)
{
String StartCourse = dr[0].ToString();
string EndCourse = dr[1].ToString();
DateTime SystemTime = Convert.ToDateTime(DateTime.Now);
DateTime StartTime = Convert.ToDateTime(StartCourse);
DateTime EndTime = Convert.ToDateTime(EndCourse);
if (StartTime.TimeOfDay.Ticks <= SystemTime.TimeOfDay.Ticks && SystemTime.TimeOfDay.Ticks < EndTime.TimeOfDay.Ticks)
{
ds.Tables[0].Rows[count][5] = "ok";
}
else
{
ds.Tables[0].Rows[count][5] = "nok";
}
count++;
dataGridView1.DataSource = ds.Tables[0];
}
}