So I have to create a multiplication question asker and it generates 2 random numbers as the form loads and puts them onto the form as a question and then a number is inputted into the answer box and the user clicks submit. If the answer is correct it will show "Very Good!", if it is incorrect it will show "No. Please try again". I need some help though with how to make a new random number for the next question button and how can I make it so it actually shows "Very Good!" when I attempt to press the submit answer button. Sorry I'm confused >_>
Code:
Public Class MultiplicationTeacherForm
Dim rand As New Random()
Dim randnum As Integer = rand.Next(1, 9)
Dim rand2 As New Random()
Dim randnum2 As Integer = rand.Next(1, 9)
Dim guess As Integer
Dim answer As Integer
Dim question As String
Private Sub MultiplicationTeacherForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
question = "How much is " & randnum & " times " & randnum2 & "?"
questionLabel.Text = question
End Sub
Private Sub nextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nextButton.Click
Dim randNext As New Random()
Dim randnumNext As Integer = rand.Next(1, 9)
Dim randNext2 As New Random()
Dim randnumNext2 As Integer = rand.Next(1, 9)
question = "How much is " & randnum & " times " & randnum2 & "?"
questionLabel.Text = question
End Sub
Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitButton.Click
answer = randnum + randnum2
guess = CInt(Val(answerTextBox.Text))
Select Case answer
Case guess
responseLabel.Text = "Very Good!"
Case Else
responseLabel.Text = "No. Please try again."
End Select
End Sub
End Class ' MultiplicationTeacherForm