设有如下通用过程,在窗体上画一个名称为command1的命令按钮,然后编写如下事件过程:
private sub command1_click()
dim x as integer
x=10
y=5
y=f(x)
print x;y
end sub
public function f (x as integer)
dim y as integer
x=20
y=2
f=x*y
end function
程序运行后,如果单击命令按钮,则在窗体上显示的内容是()
private sub command1_click()
dim x as integer
x=10
y=5
y=f(x)
print x;y
end sub
public function f (x as integer)
dim y as integer
x=20
y=2
f=x*y
end function
程序运行后,如果单击命令按钮,则在窗体上显示的内容是()
举一反三
- 窗体上有标签(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将分别显示
- 编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______
- 在窗体上画一个命令按钮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 运行窗体后,单击命令按钮,则消息框的输出结果为______。
- 在窗体上添加一个命令按钮Command1和3个标签Label1、Label2、Label3,然后编写如下代码。 Private x As Integer Private Sub Command1_Click() Static y As Integer Dim z As Integer n = 10 z = n + z y = y + z x = x + z Label1.Caption = x Label2.Caption = y Label3.Caption = z End Sub 运行程序,连续 3 次单击命令按钮后,则 3 个标签中显示的内容分别是( )。
- 有如下事件程序,运行该程序后输出结果是。 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