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

Recommended Answers

All 2 Replies

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
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.

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

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.