单选题
VB
题号 #485021
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:
Dim SW As Boolean
Function func(X As Integer)As Integer
If X<20Then
Y=X
Else
Y=20+X
End If
Func=Y
End Function
Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
SW=False
End Sub
Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)
SW=True
End Sub
Private Sub Command l Click()
Dim intNurn As Integer
IntNtim=InputBox(…f)
If SW Then
Print func(intNum)
End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为( )
参考答案
D
答案解析
布尔变量SW的初值为False,程序运行后,没有触发窗体的MouseDown和MouseUp事件,所以,SW的值始终为False。所以,程序不会执行语句Print func(intNum),也就是程序不会输出任何内容,答案是D。
你可能感兴趣的试题
A.30
B.25
C.20
D.15
A.Forml的Caption属性值为l00
B.Form2的Caption属性值为-100
C.Forml的Caption属性值为-100
D.Form2的Caption属性值为l00
A.x没有实际作用,因此可以将该语句写为:Call Shell(F1le1.F1leName,1)
B.双击文件列表框中的文件,将触发该事件过程
C.要执行的文件的名字通过F1le1.F1leName指定
D.F1le1中显示的是当前驱动器、当前目录下的文件