Public Class Form1
Dim num1 As Integer = CInt(Int((10 * Rnd()) + 1))
Dim num2 As Integer = CInt(Int((10 * Rnd()) + 1))
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
TextBox2.Text = num1 & "*" & num2
End Sub
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = num1 * num2 Then
Label2.Text = "Correct!!11"
Else
Label2.Text = "Incorrect, sorry about that"
End If
End Sub
结束类
当我运行这段代码时,它只会产生一个问题。这是6 * 8。如果我输入 48,它可以工作。但是如果我再次单击该按钮,它将不会产生另一个问题。它只会生成 6*8。我需要它能够生成 1-10 的随机乘法问题