Noah Mabile
Noah Mabile

Reputation: 1

Just generates Answer

Public Class Form1
Dim num1 As Integer = CInt(Int((10 * Rnd()) + 1))
Dim num2 As Integer = CInt(Int((10 * Rnd()) + 1))
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load



End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    ' It is meant to display the question on textbox2.text, not the answer
    TextBox2.Text = num1 * num2
End Sub

Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
    If TextBox1.Text = num1 * num2 Then
        Label2.Text = "Correct!!11"
    Else
        Label2.Text = "Incorrect, sorry about that"
    End If
End Sub

End Class

I want textbox2 to display a question like " 5 * 5" but instead it just displays "25"

Upvotes: 0

Views: 39

Answers (1)

Mez
Mez

Reputation: 4726

You are assigning the value to the textbox as a multiply of num1, and num2. You need to concatenate the string values like this

TextBox2.Text = num1 & " * " & num2 

Upvotes: 2

Related Questions