473,287 Members | 3,319 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,287 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 2412
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...
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...
1
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
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.