• 2021-04-14
    窗体上有标签(Label1、Label2)和命令按钮(Command1),编写如下事件过程: Private x As Integer: Private Sub Command1_Click(): Dim x As Integer, y As Integer: x = 5: y = 3: proc x, y: Label1.Caption = x: Label2.Caption = y: End Sub: Private Sub proc(ByVal a As Integer, b As Integer): x = a + b: b = b * b: End Sub:运行后,单击按钮,Label1和Label2将分别显示
  • 5和9

    举一反三

    内容

    • 0

      在窗体上画一个命令按钮Command1,编写事件代码如下: Public x As Integer Private Sub Command1_Click() x=3 Call f1 Call f2 MsgBox x End Sub Private Sub f1() x=x*x End Sub Private Sub f2() Dim x As Integer x=x+4 End Sub 运行窗体后,单击命令按钮,则消息框的输出结果为______。

    • 1

      有如下事件程序,运行该程序后输出结果是。 Private Sub Command33_Click() Dim x As Integer, y As Integer x = 1: y = 0 Do Until y <= 25 y = y + x * x x = x + 1 Loop MsgBox "x=" & x & ", y=" & y End Sub

    • 2

      在窗体中添加一个命令按钮(名为Command1),然后编写如下代码: Public x as integer Private Sub Command1_Click( ) x=5 Call s1 Call s2 MsgBox x End Sub Private Sub s1( ) x=x+10 End Sub Private Sub s2( ) Dim x as integer x=x+10 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果是______

    • 3

      有如下函数过程: Function secproc(x As Integer, y As Integer, z As Integer) secproc = 3 * y + z + 2 * x End Function Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 2: b = 3: c = 4 Print secproc(c, b, a) End Sub 该程序的运行结果是( )。

    • 4

      Sub s1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x: x = y: y = t End Sub Sub s2(x As Integer, y As Integer) Dim t As Integer t = x: x = y: y = t End Sub 则以下说法中正确的是( )。