新手求助   如何调出[文件选择对话框]?

解决方案 »

  1.   

    在窗体上放一个 CommonDialog1 控件,使用它的 .showopen 方法
    取得文件名后,放在 .filename 属性中
      

  2.   

    我是想做成 点击画面的一个button,然后[文件选择对话框]就弹出来,最好附上源码阿,谢谢
      

  3.   

    Private Sub Command1_Click()
        CommonDialog1.FileName = ""
        CommonDialog1.ShowOpen
        
        If CommonDialog1.FileName = "" Then
            MsgBox "没有选择文件。"
        Else
            MsgBox "选择了文件:" & CommonDialog1.FileName
        End If
    End Sub建立一个窗体,在上面放一个 CommonDialog 和一个 button,然后将上面的代码粘贴进去。
    (注意:如果工具栏上没有 CommonDialog 控件,请在vb菜单“工程-->部件”中选中 micorsoft common dialog control 6.0 
      

  4.   

    如何多选呢? 同时选多个文件呢?====================CommonDialog1.Flags = cdlOFNAllowMultiselect
      

  5.   

    InitDir参数怎么设定才可以让对话框的初始路径是 桌面 或者 我的电脑 呢?
    这个问题完了就结贴。谢谢  fxy_2002(阿勇)
      

  6.   

    CommonDialog1.InitDir = "C:\Documents and Settings\All Users\桌面"不过如果系统安装在D盘,就不行了。
    还有不同操作系统的区别,98与xp就不一样,所最终还是得动用一系列API,很麻烦。