更多"在窗体上画一个名称为CommonDialog1的通用对话框,一个名称为"的相关试题:
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个名为Command1的命令按钮,并编写如下事件过程: Private Sub Command1_ Click( ) CommonDialog1. Flags= cd10FNHideReadOnly CommonDialog1. Filter= "All Files (*.*) |*.*|Text File" & _ "(*.txt) |*.txt | Batch Files (*.bat)| *.bat" CommonDialog1. FilterIndex = 2 CommonDialog1. ShowOpen MsgBox CommonDialog1. FileName End Sub程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是______ 。
A. All Files (*.*)
B. Text Files(*.tx
C. Batch Files (*.ba
D. 不确定
[单项选择]在窗体上画一个名称为CommonDialog1的通用对话框,一个名称为Command1的命令按钮。然后编写如下事件过程: Private Sub Command1_Click( ) CommonDialogl.FileName=“” CommonDialogl,Filter=“All File|*.*|(*.Doc)|*.Doc|(*.Txt)|*.Txt” CommonDialogl.Filterlndex=2 CommonDialogl.DialogTitle=“VBTest” CommonDialogl.Action=1 End Sub对于这个程序,以下叙述中错误的是
A. 该对话框被设置为“打开”对话框
B. 在该对话框中指定的默认文件名为空
C. 该对话框的标题为VBTest
D. 在该对话框中指定的默认文件类型为文本文件(*.Tx
[填空题]
在窗体上画1个命令按钮和1个通用对话框,其名称分别为Command1和 CommonDialog1,然后编写如下事件过程:
Private Sub Command1 Click( )
CommonDialog1.()="打开文件""
CommonDialog1.Filter="All Files(*.*)|*.*"
CommonDialog1.InitDir="C:/"
CommonDialog1.ShowOpen
End Sub
该程序的功能是,程序运行后,单击命令按钮,将显示“打开”文件对话框,其标题是“打开文件”,在“文件类型”栏内显示“All Files(*.*)”,并显示C盘根目录下的所有文件,请填空。
[填空题]在窗体上画一个通用对话框,其名称为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 文件,然后单击“确定”按钮,则在信息框中显示的提示信息是______ 。
[单项选择]在窗体上有1个名称为CommonDialog1的通用对话框和1个名称为Command1的命令按钮,以及其他一些控件。要求在程序运行时,单击Command1按钮,则显示打开文件对话框,并在选择或输入个文件名后,就可以打开该文件。以下是Command1_Click事件过程的两种算法
算法1:
Private Sub Command1_Click( )
CommonDialog1.Show Open
Open CommonDialog1.File Name For Input As#1
End Sub
算法2:
Private Sub Command1_Click( )
CommonDialog1.Show Open
If CommonDialog1.File Name<>" "Then
Open CommonDialog1.File Name For Input As#1
EndIf
End Sub
下面关于这两种算法的叙述中正确的是【 】
A. 显示打开文件对话框后若未选择或输入任何文件名,则算法2会出错,算法1不会
B. 显示打开文件对话框后若未选择或输入任何文件名,则算法1会出错,算法2不会
C. 两种算法的执行结果完全一样
D. 算法1允许输入的文件名中含有空格,而算法2不允许
[单项选择]
窗体上有一个名称为CommonDialog1的通用对话框,一个名称为Command1的命令按钮,并有如下事件过程:
Private Sub Command1_Click( )
CommandDialog1.DefaultExt=”doc”
CommandDialog1.FileName=”VB.txt”
CommandDialog1.FileName=”All(*.*)|*.*|Word|*.Doc|”
CommandDialog1.FileName=1
CommandDialog1.ShowSave
End Sub
运行上述程序,如下叙述正确的是( )。
A. 打开的对话框中文件“保存类型”框中显示“All(*.*)”
B. 实现保存文件的操作,文件名是VB.txt
C. DefaultExt属性与FileName属性所指明的文件类型不一致,程序出错
D. 对话框的Filter属性没有指出txt类型,程序运行出错
[单项选择]
在窗体上有—个名为CommonDialog1的通用对话框和一个名称为Command1的命令按钮,以及其他—些控件。要求在程序运行时,单击Command1按钮,则显示打开文件对话框,并在选择或输入了—个文件名后,就可以打开该文件。以下是Command1_Click事件过程的两种算法
算法1:
Private Sub Command1_Click( )
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
End Sub
算法2:
Private Sub Command1_Click( )
CommonDialog1.ShowOpen
IfCommonDialog1.FileName<>""Then
CommonDialog1.FileName For Input As #1
End If
End Sub
下面关于这两种算法的叙述中正确的是()。
A. 显示打开文件对话框后若未选择或输入任何文件名,则算法2会出错,算法1不会
B. 显示打开文件对话框后若未选择或输入任何文件名,则算法1会出错,算法2不会
C. 两种算法的执行结果完全—样
D. 算法1允许输入的文件名中含有空格,而算法2不允许
[单项选择]在窗体上画一个通用对话框,其名称为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 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 (*.*)
[填空题]在窗体上画一个通用对话框,其名称为CommandDialog1,再画一个命令按钮,其名称为Command1。程序运行时,单击命令按钮,在对话框内只允许显示文本文件。将以下程序补充完整。
Private Sub Command1_Click( )
CommandDialog1.Filter= 【15】
CommandDialog1.ShowOpen
End Sub
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialogl,然后画一个命令按钮,并编写如下事件过程:
Private Sub Commandl_click( )
CommonDialogl.Friter="AllFiles(*.*)|*.*|Text Files"&_
"(*.txt)|*.txt|Executable Files(*.exe)|*.exe"
CommonDialog1.FilterIndex=3
CommonDialog1.Show Open
MsgBOX CommonDialog1.FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是( )。
A. AllFries(*.*)
B. TextFiles(*.txt)
C. Executable Fries(*.exe)
D. 不确定