Counting a score! Please help

james8888

New member
Joined
Oct 28, 2011
Messages
1
Programming Experience
Beginner
I am making a primary school maths game as part of a uni assessment. I am pretty bad with visual basic and tend to do everything the long way. Here is how i am trying to do it ATM:

Dim count As Integer = 0
Dim score As Integer = 0


If number1 + number2 = Val(TextBox3.Text) Then
count = count + 1
score = count
End If

If number3 + number4 = Val(TextBox4.Text) Then
count = count + 1
score = count
End If

If number5 + number6 = Val(TextBox7.Text) Then
count = count + 1
score = count
End If

If number7 + number8 = Val(TextBox10.Text) Then
count = count + 1
score = count
End If

If number9 + number10 = Val(TextBox13.Text) Then
count = count + 1
score = count
End If

If number11 + number12 = Val(TextBox28.Text) Then
count = count + 1
score = count
End If

If number13 + number14 = Val(TextBox25.Text) Then
count = count + 1
score = count
End If

If number15 + number16 = Val(TextBox22.Text) Then
count = count + 1
score = count
End If

If number17 + number18 = Val(TextBox19.Text) Then
count = count + 1
score = count
End If

If number19 + number20 = Val(TextBox16.Text) Then
count = count + 1
score = count
End If

TextBox31.Text = score

I know this is totally wrong and it isnt working, is anyone able to help please? Any aSSISTANCE WOULD BE GREATLY APPRECIATED :)
 
You've told us that you are trying to do "it" and "it" is not working but you haven't explained what "it" is. If you were to explain what the code is supposed to do then it would be easier for us to explain how to do it.
 
Why do you have so many textboxes and numbers? If you want to add 2 numbers then you need only 2 inputs.

Why are you using score = count when you only need the count?

In order to increment a counter, you should place your code inside a loop.

To evaluate whether the result of the math problem is correct, you need to use a variable that will compute the result. Compare the result with the user's answer to see if it matches. If it does, then you can increment the counter.
 
Back
Top