更多"在窗体上画一个命令按钮,名称为Command1,然后编写如下程序: "的相关试题:
[单项选择]在窗体上画1个命令按钮,名称为Command1,然后编写如下程序: Dim Flag As Boolean Private Sub Command1_Click( ) Dim intNum As Integer intNum=InputBox("请输入:") If Flag Then Printf(intNum) End If End Sub Function f(x As Integer)As Integer If X<10 Then Y=X Else Y=X+10 End If f=Y End Function Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single) Flag=True End Sub 运行程序,首先单击窗体,然后单击命令按钮,在输入对话框中输入5,则程序的输出结果为( )。
A. 0
B. 5
C. 15
D. 无任何输出
[单项选择]在窗体上画 1 个命令按钮,名称为 Command1,然后编写如下程序:
Dim Flag As Boolean
Private Sub Command1_Click( ) Dim intNum As Integer intNum=InputBox("请输入:")
If Flag Then
Print f(intNum) End If
End Sub
Function f(X as Integer)As Integer
If X<10 Then
Y=X Else
Y=X+10
End If f=Y
End Function
Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X as Single,Y As Single) Flag=True
End Sub 运行程序,首先单击窗体,然后单击命令按钮,在输入对话框中输入5,则程序的输 出结果为______。
A. 0
B. 5
C. 15
D. 无任何输出
[单项选择]在窗体上画一个名称为Commana1的命令按钮,然后编写如下程序:
Dim SW As Boolean
Function func(X As Integer)As Integer
If X<20 Then
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 Commandl_Click( )
Dim intNum As Integer
intNum = InputBox(" ")
If SW Then
Print func(intNum)
End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为
A. 输出0
B. 输出25
C. 输出45
D. 无任何输出
[单项选择]在窗体上画一个名称为Coramandl的命令按钮,然后编写如下程序;
Dim SW As Boolean
Function func(X As Integer)As Integer
If X<20 Then
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)
Dim a As Boolean
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 Command1_Click( )
Dim intNum As Integer
intNum=InputBox("")
If SW Then
Print flmc(intNum)
End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为
A. 输出0
B. 输出2
C. 输出45
D. 无任何输出
[填空题]在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个名称为Command1的命令按钮,并编写如下事件过程:
Private Sub Command1_ Click( )
CommonDialog1. Flags = cd10FNHideReadOnly
CommonDialog1. Filter= "All Files (*.*) |*.* |Text Files" &
"(*.txt |*.txt|Batch Files (*.bat)|*.bat)"
CommonDialog1. FilterIndex = 1
CommonDialog1.ShowOpen
MsgBox CommonDialog1.FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是 ______ ;如果在对话框中选择D盘temp 目录下的te1.txt 文件,然后单击“确定”按钮,则在信息框中显示的提示信息是______ 。
[单项选择]在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Dim k As Integer Private Sub Form_Load( ) k=15 End Sub Private Sub Command1_Click( ) Static b As Integer b=b+k k=k+1 Print k,b End Sub 程序运行时,两次单击命令按钮Command1后,在窗体上显示的第二行是( )。
A. 17 31
B. 15 31
C. 17 16
D. 2 1
[单项选择]在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Dim SW As Boolean Function func(X As Integer)As Integer IfX<20 Then Y=X Else Y=20+X End lf 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 SinSle,Y As Single) SW=True End Sub Prinvate Sub Command1_Click( ) Dim intNum As Integer intNum=InputBox(””) If SW Then Print func(intNum) End If End Sub 程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为
A. 输出0
B. 输出25
C. 输出45
D. 无任何输出
[单项选择]在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:
Dim SW As Boolean
Function func(X As Integer) As Integer
If X < 20 Then
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 Command1_Click( ) Dim intNum As Integer intNum = InputBox("")
If SW Then
Print func(intNum) End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在输入对话框中输入25,则 程序的执行结果为______。
A. 输出0
B. 输出25
C. 输出45
D. 无任何输出