G
Guest
I have teo buttons ont the display the problem and for the user to submit the
answer, but it is not comparing the user's answer
Private Sub btnNQuestion_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNQuestion.Click
num1 = rand.Next(1, 15)
num2 = rand.Next(1, 15)
Dim sr As StreamReader
Dim sw As StreamWriter
Dim ans As String
If rbtnAdd.Checked Then
lblQuestion.Text = num1.ToString() & "+" & num2.ToString()
ElseIf rbtnSubtract.Checked Then
lblQuestion.Text = num1.ToString() & "-" & num2.ToString()
End If
txtanswer.Clear()
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim ans As Integer
ans = (num1 + num2)
ans = (num1 - num2)
If ans = txtanswer.Text Then
lblNofQ.Text = "correct"
Else
lblNofQ.Text = "Incorrect"
End If
End Sub
End Class
answer, but it is not comparing the user's answer
Private Sub btnNQuestion_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNQuestion.Click
num1 = rand.Next(1, 15)
num2 = rand.Next(1, 15)
Dim sr As StreamReader
Dim sw As StreamWriter
Dim ans As String
If rbtnAdd.Checked Then
lblQuestion.Text = num1.ToString() & "+" & num2.ToString()
ElseIf rbtnSubtract.Checked Then
lblQuestion.Text = num1.ToString() & "-" & num2.ToString()
End If
txtanswer.Clear()
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim ans As Integer
ans = (num1 + num2)
ans = (num1 - num2)
If ans = txtanswer.Text Then
lblNofQ.Text = "correct"
Else
lblNofQ.Text = "Incorrect"
End If
End Sub
End Class