title: How can I get the backcolor of a button to change colour if it contains the correct answer? Visual Basic 2010
body: <p>I have created a multiple choice quiz, but am struggling with coming up with the correct code to make it so that if the player selects the button containing the correct answer, its BackColor will turn green for a few seconds, before the next question appears automatically and returns to its normal BackColor. </p>
  
  <p>Also, if the player selects the button containing the wrong answer, then its BackColor turns red to establish to the player that they were incorrect.</p>
  
  <p>For this, I have a <code>label</code> called <code>lblQuestion</code>, which contains the question being asked and then four <code>buttons</code> (<code>btnAnswerA</code>, <code>btnAnswerB</code>, <code>btnAnswerC</code> and <code>btnAnswerD</code>) which all contain a potential answer to the question, with of course, only one being correct.</p>
  
  <p>I have been fiddling around with the code for sometime, trying to get it to work, but it doesn't work how I want to, so thought to come on here for some guidance in this matter.</p>
  
  <p>Below is some of the code relating to this issue. I am sure by looking at it, many of you will know where I am going wrong!</p>
  
  <pre><code>Private Sub btnAnswerA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswerA.Click
  
      If strAnswer = "A" Then
          btnAnswerA.BackColor = Color.Green
          intScore = intScore + 100
          lblScore.Text = intScore
      Else
          btnAnswerA.BackColor = Color.Red
          Call GetQuestion(questionNumber)
      End If
  
      Call GetQuestion(questionNumber)
      prgbarOne.Value = 0
  
  End Sub
  
  Private Sub btnAnswerB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswerB.Click
  
      If strAnswer = "B" Then
          btnAnswerB.BackColor = Color.Green
          intScore = intScore + 100
          lblScore.Text = intScore
      Else
          btnAnswerB.BackColor = Color.Red
          Call GetQuestion(questionNumber)
      End If
  
      Call GetQuestion(questionNumber)
      prgbarOne.Value = 0
  
  End Sub
  
  Private Sub btnAnswerC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswerC.Click
  
      If strAnswer = "C" Then
          btnAnswerC.BackColor = Color.Green
          intScore = intScore + 100
          lblScore.Text = intScore
      Else
          btnAnswerC.BackColor = Color.Red
          Call GetQuestion(questionNumber)
      End If
  
      Call GetQuestion(questionNumber)
      prgbarOne.Value = 0
  
  End Sub
  
  Private Sub btnAnswerD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswerD.Click
  
      If strAnswer = "D" Then
          btnAnswerD.BackColor = Color.Green
          intScore = intScore + 100
          lblScore.Text = intScore
      Else
          btnAnswerD.BackColor = Color.Red
          Call GetQuestion(questionNumber)
      End If
  
      Call GetQuestion(questionNumber)
      prgbarOne.Value = 0
  
  End Sub
  </code></pre>
  
  <p>Basically, I just need some help with knowing how to get the BackColor to turn green/red (depending on whether they're right or wrong) for a few moments before showing the next question where <code>Call GetQuestion(questionNumber)</code> is and knowing how to get the original BackColor (which is Gray) to return for the next question before the player has clicked on a button.</p>
  
  <p>Hope this makes sense and any help is really appreciated. I apologise, I am still new to programming (as you may tell). Also, if more code is needed, I will submit it.</p>