在窗体上画一个通用对话框,其名称为CommonDialog1,然后画一个命令按钮,并编写如下事件过程:
Private Sub Command1_ Click()
CommonDialog1. Flags= cd1OFNHideReadOnly
CommonDialog1. Filter="All Files(*.*)|*.*|Text Files"&_
"(*.txt)|*. txt|Batch Files(*.bat)|*.bat"
CommonDialog1. FilterIndex=2
CommonDialog1. ShowOPen
MsgBox CommonDialog1. filename
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是 ______。
A.All Files(*.*)
B.Text Files(*.txt)
C.Batch Files(*.bat)
D.不确定
参考答案:B
解析:[评析] 从程序可见FilterIndex属性已经设为2,所以缺省过滤器为*.txt。