471,872 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,872 software developers and data experts.

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,

Expand|Select|Wrap|Line Numbers
  1. cdlfiles.filter="files(*.srt)\*.ami"
  2. cdlfiles.DefaultExt="str"
  3. cdlfiles.dialogTitle="save str notepad file"
  4. cdlfiles.DialogTitel=cdlOFNOverwritePrompt + cdlOFNPathmustexist
  5. on Error GoTo e
  6. cdlfiles.showsave
  7. Open cdlfiles/FileName for Output As #1
  8. Print#1,Text1.Text
  9. close 1
  10. Exit Sub
  11. e:
  12. Resume Exitline
  13. Exitline:
  14. Exitsub
  15. end sub

please give me open code using microsoft common dialog control.6
Jun 19 '07 #1
1 2267
8,435 Expert 8TB
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.)
Jun 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Gord | last post: by
23 posts views Thread by George | last post: by
reply views Thread by Bo Gusman | last post: by
6 posts views Thread by Steve Barnett | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.