0

i'm trying to open a txt file and write the text included in a texbox
so how can i get the open window to choose the file i want to open :o thanks

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by b.janahi
0

You need to use the commondialog control. So, Click the Project menu, then select componants. In the new window find microsoft common dialog control, and put a check in it. Now Hit Ok. A new control appears in the toolbox, double click it (or drag it to the form). Then, in a command button (or whenever you want to use it), do this:

dim chosenfilename as string
commondialog1.showopen
chosenfilename = commondialog1.filename
if chosenfilename = vbnullstring then
     msgbox "Please Select A File"
     exit sub
end if

After the code above, The variable chosenfilename with contain the path and filename to whatever the user selected.

0

thank u very much , i didn't thougt that it could be that easy

thanks again

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.