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
クラス終了
このコードを実行すると、質問が 1 つだけ生成されます。これは 6*8 です。48 を入力すると動作しますが、もう一度ボタンをクリックしても別の質問は生成されません。6*8 のみが生成されます。1 から 10 までのランダムな掛け算の質問を生成できるようにする必要があります