更多"在窗体上画一个名为Command1的命令按钮。下列程序的功能是:从输入"的相关试题:
[单项选择]在窗体上画一个名称为CommonDialogl的通用对话框,一个名为Command1的命令按钮。要求单击命令按钮时,打开一个保存文件的通用对话框。该窗体的标题为“Save”,默认文件名为“SaveFile”,在“文件类型”栏中显示*. txt,则能够满足上述要求的程序是______。
A. Private Sub Command1_C1ick()
B. Private Sub Command1_Click()
C. Private Sub Command1_Click()
D. Private Sub Command1_Click()
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialogl,然后画一个命令按钮,并编写如
Private Sub Command1_Click( )
CommonDialogl. Flags = vbOFNHideReadOnly
CommonDialogl. Filter =" All Files(*.*)|*. * |Text Files(*.txt)|*. txt
CommonDialogl. FilterIndex = 1
CommonDialogl. ShowOpen
MsgBox CommonDialogl. FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是
A. All Files(*.*)
B. Text Files(*.txt)
C. Batch Files(*.bat)
D. All Files(*. *)
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialogl,然后画一个命令按钮,并编写如下事件过程: Private Sub Command1_Click( ) CommonDialogl.Flags=cdlOFNHideReadOnly CommonDialogl.Filter="All Files(*.*)|*.*|Text Files"& "(*.txt)|*.txt|Batch Files(*.bat)|*.bat" CommonDialogl.FilterIndex=2 CommonDialogl.ShowOPen MsgBoxCommonDialogl.filename End Sub 程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显,示的是 ______。
A. All Files(*.*)
B. Text Files(*.tx
C. Batch Files(*.ba
D. 不确定
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialogl,然后画一个命令按钮,并编写如 下事件过程:
Private Sub Commandl_Click( )
CommonDialogl,Flags=vbOFNHideReadOnly
CommontDialogl.Filter="All Files(*.*)|*.*|Text Files (*.*)|*.txt|"_
& Batch Files (*.bat) |*.bat"
CommonDialogl.Filterlndex=1
CommonDialogl.Showopen
MsgBox CommonDialogl.FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是( )。
A. All Fries(*.*)
B. Text Files(*.*)
C. Batch Files(*.bat)
D. All Files (*.*)
[填空题]
在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个命令按钮,并编写下列事件过程:
Private Sub Command1_Click( )
CommonDialog1.Filter="All Files(*.*)|*.*|Text Files"_
&"(*.txt)|*.txt|Batch Files(*.bat)|*.bat"
CommonDialog1.FilterIndex=1
CommonDialog1.ShowOpen
MsgBox CommonDialog1.FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是();如果在对话框中选择d盘temp目录下的tel.txt文件,然后单击“确定”按钮,则在MsgBox信息框中显示的提示信息是()。
[单项选择]在窗体上画一个通用对话框,其Name属性为Cont,再画一个命令按钮,Name属性为Command1,然后编写如下事件过程:
Private Sub Command1 Click( )
Cont.FileName=" "
Cont.Flags=vbOFNFileMustExist
Cont.Filter="All Filesl|*.*"
Cont.FilterIndex=3
Cont.DialogTitle="Open File"
Cont.Action=1
If Cont.FileName=" " Then
MsgBox "No file selected"
Else
Open Cont.FileName For Input As # 1
Do While Not EOF(1)
Input # 1,b$
Print b$
Loop
End If
End Sub
以下各选项,对上述事件过程描述错误的是( )
A. 该事件过程用来建立一个Open对话框,可以在这个对话框中选择要打开的文件
B. 选择后单击“打开”按钮,所选择的文件名即作为对话框的FileName属性值
C. Open对话框不仅用来选择一个文件,还可以打开、显示文件
D. 过程中的“Cont.Action=1”用来建立Open对话框,它与Cont.ShowOpen等价
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个命令按钮,并编写如下事件过程:
Private Sub Command1_Click( )
CommonDialog1.Flags:vbOFNHideReadOnly
CommonDialog1.Filter: "All Files(*.*)|*.*|Text Files1*.txt)|*.txt
CommonDialog1.FilterIndex=1
CommonDialog1.ShowOpen
MsgBox CommonDialog1.FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是( )。
A. All Files(*.*)
B. Text Files(*.txt)
C. Batch Files(*.bat)
D. All Files(*.*)
[单项选择]在窗体上画一个名称为CommonDialogl的通用对话框,一个名称为Commandl的命令按钮。然后编写如下事件过程:
Private Commandl_Click( )
CommonDialogl.FileName=""
CommonDialogl.Filter="Allfile|*.*|(*.Doc)|*.Doc|(*.Txt)|*.Txt"
CommonDialogl.Filterlndex=2
CommonDialogl.DialogTifle="VBTest"
CommonDialogl.Action=1
EndSub
对于这个程序,以下叙述中错误的是( )。
A. 该对话框被设置为“打开”对话框
B. 在该对话框中指定的默认文件名为空
C. 该对话框的标题为VBTest
D. 在该对话框中指定的默认文件类型为文本文件(*.Txt)