title: Wrong output using random VB
body: <p>I'm writing a program for my vba class, it's almost complete but i'm running into one small problem. The program is supposed to ask a random multiplication question then the user hits submit to check weather the are right or wrong. All that works fine, however the answer to to the first question is the answer to all of them, even when the user hits next for the next question. Example, 1st question could be 6 *3 and the user enters 21 and it will say correct. The next question will come up say 3 * 2. If the user enters 6 it will say wrong, but if 21 is entered again its correct. I'm sure I am missing some really simple, but its driving me crazy and i'm pretty new to this. Any help is much appreciated!!Sorry if any of this is confusing.</p>
  
  <pre><code>Public Class MultiplicationTeacherForm
      Dim randomObject As New Random
      Dim one As Integer = randomObject.Next(1, 10)
      Dim two As Integer = randomObject.Next(1, 10)
  
  Private Sub nextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nextButton.Click
  
      Dim one As Integer = randomObject.Next(1, 10)
      Dim two As Integer = randomObject.Next(1, 10)
      question.Text = ("How much is " &amp; one &amp; " times " &amp; two)
  
  End Sub
  
  Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
  
      Dim three As Integer = randomObject.Next(1, 3)
      Dim ans As Integer = one * two
      Dim correct As String = answer.Text
      Dim x As Integer = Convert.ToInt16(correct)
  
      If (three = 1) And (ans = x) Then
          response.Text = "Very Good!"
      ElseIf (three = 2) And (ans = x) Then
          response.Text = "Excellent!"
      ElseIf (three = 3) And (ans = x) Then
          response.Text = "Great Job!"
      Else
          response.Text = "No, Please try again."
      End If
  End Sub
  
  
  Private Sub MultiplicationTeacherForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      question.Text = ("How much is " &amp; one &amp; " times " &amp; two)
  End Sub
  </code></pre>