O.k. guys trying to teach myself in VB6 to start i am writing a math program for my daughter but i am having trouble with my code to keep score. the program is two random numbers that pop up in 2 txtboxes and a 3 txtbox for the answer on a 3 min timer what i want to do is keep track of how many she got right and display it at the end of the 3 min. here is the code any info you code give will be helpful and if you see any other mistakes in the code let me know.
as the code is it will add one to txt.score on the first right answer but then nothing after that. Thanks in advance for any help
Code:
Private Sub cmdcheck_Click() Dim score As Integer score = score + 1 txtscore.Text = score Dim sum As String x = Answer.Text sum = val(text1.Text) + val(Text2.Text) If x = sum Then score = score + 1 MsgBox "Good Job!" 'put random number in textbox 1 text1.Text = Int((10 - 0 + 1) * Rnd + 0) 'put random number in textbox 2 Text2.Text = Int((10 - 0 + 1) * Rnd + 0) 'clear textbox 3 for the answer Answer.Text = "" Else MsgBox "wrong" ' put random number in textbox 1 text1.Text = Int((10 - 0 + 1) * Rnd + 0) ' put random number in textbox 2 Text2.Text = Int((10 - 0 + 1) * Rnd + 0) ' clear textbox 3 for the answer Answer.Text = "" End If End Sub
Comment