How to check textbox inputs
--------------------------------------------------------------------------------
Hi I relatively new to VB.Net. And I have to create a sort of quiz type application.
There are a few Text boxes where the user will input their answers. I want the code to check the users input and compare with set answer. If correct add 1 to a total and at the end display the total correct answers. I have a code but I keep getting Errors like cannot convert boolean to integer etc. Any help please..
this is my code at the moment what is wrong?
Private Sub btnCheck_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCheck.Click
Dim TotalAns As Integer
Dim txt As Boolean
Select Case txt
Case txtRep1.Text = "A"
TotalAns += 1
Case txtRep2.Text = "B"
TotalAns += 1
End Select
txtResults.Text = Str(TotalAns)
End Sub
End Class
--------------------------------------------------------------------------------
Hi I relatively new to VB.Net. And I have to create a sort of quiz type application.
There are a few Text boxes where the user will input their answers. I want the code to check the users input and compare with set answer. If correct add 1 to a total and at the end display the total correct answers. I have a code but I keep getting Errors like cannot convert boolean to integer etc. Any help please..
this is my code at the moment what is wrong?
Private Sub btnCheck_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCheck.Click
Dim TotalAns As Integer
Dim txt As Boolean
Select Case txt
Case txtRep1.Text = "A"
TotalAns += 1
Case txtRep2.Text = "B"
TotalAns += 1
End Select
txtResults.Text = Str(TotalAns)
End Sub
End Class