Results 1 to 5 of 5

Thread: code to display path in common dialog box

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    14

    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?

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    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
    Life is about making some things happen, not waiting around for something to happen.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    14

    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?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: code to display path in common dialog box

    Yes, show us your code.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width