• 2021-04-14
    在窗体上有一命令按钮Command1,其Click事件代码如下:
    Private Sub Command1_Click()
    Dim a%, b%, i%, n%
    For i = 1 To 10
    n = InputBox("请输入一个整数", "输入数据框", 2)
    If n Mod 2 = 0 Then
    a = a + 1
    Else
    b = b + 1
    End If
    Next i
    MsgBox ("运行结果a=" & str(a) & ", b=" & str(b))
    End Sub
  • 举一反三