title: How do you store and count a score for a math quiz in VB.net?
body: <p>I'm quite new to VB and am doing a small school project, I am making a math quiz that will as the user random math questions and if they get the question correct then their score will increase by 1, i do not know how to count the score though. This is the code i have so far: </p>
  
  <pre><code>Public Class Form1
      Dim Ans As Integer
      Dim Num As Integer
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          CreateProblem()
          CreateScore()
      End Sub
  
      Sub CreateProblem()
          Dim Generator As New Random
          Dim Num1 As Integer = Generator.Next(15, 20)
          Dim Num2 As Integer = Generator.Next(0, 15)
          Dim Show As String = ""
          Dim SumType As Integer = Generator.Next(1, 3)
          If SumType = 1 Then 
              Show = Num1 &amp; "+" &amp; Num2 &amp; "= ?"
              Ans = Num1 + Num2
          ElseIf SumType = 2 Then 
              Show = Num1 &amp; "-" &amp; Num2 &amp; "= ?"
              Ans = Num1 - Num2
          ElseIf SumType = 3 Then
              Show = Num1 &amp; "*" &amp; Num2 &amp; "= ?"
              Ans = Num1 * Num2
          End If
          Label4.Text = Show
  
  
      End Sub
      Sub CreateScore()
          Dim Score As Integer
          If Ans = Val(txtAnswer.Text) Then 
              Score = Score + 1 
          End If
          If Score &gt;= 10 Then 
              MsgBox("Well Done! You have completed the quiz!")
          End If
          lblScore.Text = Score 
      End Sub
  
      Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
          Call CreateProblem()
          txtAnswer.Text = ""
      End Sub
  
      Private Sub txtAnswer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAnswer.TextChanged
  
      End Sub
  
      Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
  
      End Sub
  
      Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
          If Val(txtAnswer.Text) = Ans Then 
              MsgBox("Correct")
          Else
              MsgBox("Incorrect") 
          End If
          Call CreateScore()
      End Sub
  End Class
  </code></pre>