我在用Commondialog时,有时按"取消"的时候.文件还是被选中了.我应当怎么样解决呢??请高手帮帮忙.

解决方案 »

  1.   

    补充:就是在用showopen打开的时候,我在对话框中选了一个文件,但我没有点击打开,而是点击了取消,但是文件同样被选中了.我的本意是取消选中的内容.
      

  2.   

    不知道是不是这个问题:
    少了一个条件 If CommonDialog1.FileName = "" Then Exit SubPrivate Sub Command1_Click()
    CommonDialog1.ShowOpen
    If CommonDialog1.FileName = "" Then Exit Sub
    ''Do the things you want
    End Sub
      

  3.   

    也可以这样:
        On Error Goto ExitLine
        Commondialog1.CancelError = True     ...ExitLine:
        Exit Sub