Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a As Integer, b As Integer
        Randomize()
        a = Int(Rnd() * 90) + 10
        b = Int(Rnd() * 90) + 10
        TextBox1.Text = a
        TextBox2.Text = b
        TextBox3.Text = ""
        TextBox3.Focus()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As Integer, y As Integer, z As Integer
        Dim s As String
        Dim m As Integer
        x = Val(TextBox1.Text)
        y = Val(TextBox2.Text)
        z = x + y
        s = IIf(Val(TextBox3.Text) = z, "恭喜，回答正确", "很遗憾，回答错误！")
        m = MsgBox(s, 1 + 64 + 0, "判断结果")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim a As Integer, b As Integer
        Randomize()
        a = Int(Rnd() * 90) + 10
        b = Int(Rnd() * 90) + 10
        TextBox1.Text = a
        TextBox2.Text = b
        TextBox3.Text = ""
    End Sub

    Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        TextBox3.Focus()
    End Sub
End Class
