Wait one second in running program

Selçuklu Ebrar picture Selçuklu Ebrar · May 5, 2012 · Viewed 345.5k times · Source
dataGridView1.Rows[x1].Cells[y1].Style.BackColor = System.Drawing.Color.Red;
System.Threading.Thread.Sleep(1000);

İ want to wait one second before printing my grid cells with this code, but it isn't working. What can i do?

Answer

Matt Dawdy picture Matt Dawdy · May 5, 2012

Is it pausing, but you don't see your red color appear in the cell? Try this:

dataGridView1.Rows[x1].Cells[y1].Style.BackColor = System.Drawing.Color.Red;
dataGridView1.Refresh();
System.Threading.Thread.Sleep(1000);