更多"若要添加CommonDialog控件,则应从“工程”菜单中选择“部件”"的相关试题:
[填空题]若要添加CommonDialog控件,则应从“工程”菜单中选定“部件”,在“部件”对话框的“控件”选项卡中选择______,将控件添加到工具箱中。
[单项选择]下列关于通用对话框CommonDialog1的叙述中,错误的是( )。
A. 只要在“打开”对话框中选择了文件,并单击“打开”按钮,就可以将选中的文件打开
B. 使用CommonDialog1. ShowColor方法,可以显示“颜色”对话框
C. CancelError属性用于控制用户单击“取消”按钮关闭对话框时,是否显示出错警告
D. 在显示“字体”对话框前,必须先设置CommonDialog1的Flags属性,否则会出错
[单项选择]在窗体上有一个名称为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
If CommonDialog1.FileName<>"" Then
Open CommonDialog1.FileName For Input As #1
End If
End Sub
下列关于这两种算法的叙述中正确的是
A. 显示打开文件对话框后若未选择或输入任何文件名,则算法2会出错,算法1不会
B. 显示打开文件对话框后若未选择或输入任何文件名,则算法1会出错,算法2不会
C. 两种算法的执行结果完全一样
D. 算法1允许输入的文件名中含有空格,而算法2不允许
[单项选择]在窗体上画一个名称为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. 该对话框的标题为VBTest
C. 在该对话框中指定的默认文件名为空
D. 在该对话框中指定的默认文件类型为文本文件(*.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( )
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 文件,然后单击“确定”按钮,则在信息框中显示的提示信息是______ 。
[单项选择]在窗体上画一个通用对话框,其名称为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. 不确定
[填空题]在窗体上画一个命令按钮和一个通用对话框,其名称分别为Command1和CommonDialog1,然后编写如下事件过程:
Private Sub Command1_Click( )
CommonDialog1.______="打开文件"
CommonDialog1.Filter="All Files(*.*)|*.*"
CommonDialog1.InitDir="C:/"
CommonDialog1.ShowOpen
End Sub
该程序的功能是:程序运行后,单击命令按钮,将显示“打开”文件对话框,其标题是“打开文件”,在“文件类型”栏内显示“All Files(*.*)”,并显示C盘根目录下的所有文件。请填空。
[单项选择]在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个命令按钮,并编写如下事件过程:
Private Sub Command1_Click( )
CommonDialog1.Flags=cdlOFNHideReadOnly
CommonDialog1.Filter="All Files(*.*)|*.*|Text Files"&_
"(*.txt)|*.txt |Batch Files (*.bat)|*.bat"
CommonDialog1.Filterlndex=2
CommonDialog1.ShowOPen
MsgBox CommonDialog1.filename
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是 ______。
A. All Files(*.*)
B. Text Files(*.txt)
C. Batch Files(*.bat)
D. 不确定