473,241 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 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 2407
Killer42
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

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

Similar topics

0
by: Wanda | last post by:
Hello, I would like to create an interface which allow the user to select files from a ftp site using the common dialog contro. And after some manipulation in the program, the new output file...
1
by: Gord | last post by:
Hello, Does anyone know how to access the caption property on a command button within the common dialog control? Specificaly, I'm trying to change the caption of the 'Open' button in the 'Open...
3
by: S.W. Rasmussen | last post by:
With the risk of being accused of multi-posting I would like to draw the attention to a serious visual basic/windows issue discussed in the microsoft.public.vb.bugs newsgroup. As pointed out below...
2
by: Robin | last post by:
I need to add a checkbox to the common dialog control for opening files. I know it is possible to customize the common dialog thru API. But the sample codes I have seen were too long and...
23
by: George | last post by:
Is there a way to customize the open file common dialog? I am trying to modify the button text so I can create a delete file common dialog. I need the same functionality of the open file common...
0
by: Bo Gusman | last post by:
A curious problem, one that I think I've seen before. I have a .250 MLOC vb6 app that uses the common dialog control. If I select File/Open in my app to display the file open dialog and then...
6
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a...
8
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.