code to display path in common dialog box
I am new to VB and using VB6 and created a common dialog box. I want the user to be able to search for a file on their hardrive and have it display in the text box I made. I want the user to be able to either type in the file path name or browse for the path but I do not know how to make the path name appear in the text box. How do I code this?
Re: code to display path in common dialog box
Code:
Private Sub Form_Load()
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Is a way to browse for file and display it in a textbox
you'll need to use some buttons (search for text in textbox) to get the other part
try it may just get it on your own with a little help
Re: code to display path in common dialog box
I have a text box on the form and a command button. When I click on the cmd it allows me to click the file I want. However it is still not displaying in the text box. Any other suggestions?
Re: code to display path in common dialog box
Re: code to display path in common dialog box
What doesn't show up in the textbox? crater's code will give you the path to the file and if you want the contents of the file then look in the VB FAQ forum.