Use common dialog control to open a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sirimanna
    New Member
    • Apr 2007
    • 21

    Use common dialog control to open a file

    I want to know how can i open some text file data using microsoft common dialog control.6 I know how to save text data using microsoft common dialog control.6
    code are here,


    [CODE=vb]cdlfiles.filter ="files(*.srt)\ *.ami"
    cdlfiles.Defaul tExt="str"
    cdlfiles.dialog Title="save str notepad file"
    cdlfiles.Dialog Titel=cdlOFNOve rwritePrompt + cdlOFNPathmuste xist
    on Error GoTo e
    cdlfiles.showsa ve
    Open cdlfiles/FileName for Output As #1
    Print#1,Text1.T ext
    close 1
    Exit Sub
    e:
    Resume Exitline
    Exitline:
    Exitsub
    end sub[/CODE]


    please give me open code using microsoft common dialog control.6
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Keep in mind, you don't use the common dialogue control to open, read or write a file. It is merely used to choose a file (or files). Once that has been done, then you perform the appropriate action.

    Selecting a file to read is almost the same as opening it to write. You just use slightly different parameters - for example, you won't want an "overwrite? " prompt if the user chooses an existing file. More likely you would want to use the file-must-exist flag.

    And I think the method to use is ShowOpen, rather than ShowSave.

    Also, as I said before, it's better to paste your code rather than typing it in. Not only is it quicker and easier, but it saves others here from trying to run mis-typed code while trying to help. (Example: I've never heard of the DialogTitel property.)

    Comment

    Working...