A
alkmenel
Guest
This is my first time using Visual basic hence im a newbie programmer. Im trying to make this Math game and I have a problem trying to get this variable(SCORE) to repeat itself in the "If Statement" Example: The first time i get the answer right the score appears but the second time right the score doesnt add up (+10).. (the bolded texts and underline is what i am having problems on) can anyone help me figure this out? suggestions? thanks. here is the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Checks Answer
Answer = (rannum1 + rannum2)
If txtGuess.Text = "" Then
MsgBox("Enter the answer of the problem")
txtGuess.Focus()
Exit Sub
End If
If txtGuess.Text = Answer Then
Do
lblScore.Text = CInt(Score + 10)
Randomize()
rannum1 = Int(Rnd() * 50) + 1
Randomize()
rannum2 = Int(Rnd() * 50) + 1
txtNum1.Text = CInt(rannum1)
TxtNum2.Text = CInt(rannum2)
txtGuess.Text = ""
txtAnswer.Text = "???"
Exit Do
Loop
MsgBox("CORRECT!")
Else --etc...
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Checks Answer
Answer = (rannum1 + rannum2)
If txtGuess.Text = "" Then
MsgBox("Enter the answer of the problem")
txtGuess.Focus()
Exit Sub
End If
If txtGuess.Text = Answer Then
Do
lblScore.Text = CInt(Score + 10)
Randomize()
rannum1 = Int(Rnd() * 50) + 1
Randomize()
rannum2 = Int(Rnd() * 50) + 1
txtNum1.Text = CInt(rannum1)
TxtNum2.Text = CInt(rannum2)
txtGuess.Text = ""
txtAnswer.Text = "???"
Exit Do
Loop
MsgBox("CORRECT!")
Else --etc...
Thanks