I'm working on a small C# Windows Form application. In this application, I've used Thread.Sleep to wait on the current screen before moving to the next one. The problem is that before the Thread.Sleep line, I've changed the color of some of the buttons. What's weird is that it doesn't show that the color of the buttons changed. Just like it imedietly skips to the Threat.Sleep line.
That's the code that causes the problem:
for(int i = 0; i < Buttons.Count; i++)
{
if(Buttons[i].Text == currentCard.rightAnswer)
{
Buttons[i].BackColor = Color.Green;
}
else
{
Buttons[i].BackColor = Color.Red;
}
}
lbl_correctOrWrong.Visible = true;
if(btn.Text == currentCard.rightAnswer)
{
lbl_correctOrWrong.ForeColor = Color.Green;
lbl_correctOrWrong.Text = "Currect!";
}
else
{
lbl_correctOrWrong.ForeColor = Color.Red;
lbl_correctOrWrong.Text = "Wrong!";
}
Thread.Sleep(1500);
MoveToNextQuestion();
Any help would be much appreciated, thanks!