Results 1 to 8 of 8

Thread: How to open a directory instead of a specific file.

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    42

    How to open a directory instead of a specific file.

    At the moment I am using this:
    Code:
    Dim Open As New OpenFileDialog
            Open.ShowDialog()
            TextBox2.Text = Open.FileName
    But that only allows me to open specific files. Can I make it so I can open a folder?

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: How to open a directory instead of a specific file.


  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    42

    Re: How to open a directory instead of a specific file.

    Quote Originally Posted by ForumAccount View Post
    Thanks!

    This is my new code:
    Code:
    Dim Open As New FolderBrowserDialog
    Open.ShowDialog()
    TextBox2.Text = Open.RootFolder
    On the last line should I be using RootFolder or is there another alternative? Also, whatever file I open Textbox2 always shows a "0" not the folder location. Why is this?

  4. #4
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: How to open a directory instead of a specific file.

    Of all the properties which one looks like it would make the most sense of a user selecting a path?

    #2048

  5. #5
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: How to open a directory instead of a specific file.

    [Recomendation] do not use "Open" as the object name
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    42

    Re: How to open a directory instead of a specific file.

    Quote Originally Posted by ForumAccount View Post
    Of all the properties which one looks like it would make the most sense of a user selecting a path?

    #2048
    No idea, that's why I am asking. And Also why is a number appearing instead of a directory?

    Thanks!

    EDIT: No worries, I've done it now. Thanks for the help.
    Last edited by Procrastinator; Jun 13th, 2011 at 11:38 AM.

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: How to open a directory instead of a specific file.

    really?
    Did you read the documentation linked?
    So... when you read "Gets or sets the path selected by the user." ... that didn't trigger anything?\

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    42

    Re: How to open a directory instead of a specific file.

    Yeah I've got it sorted now. Thanks everyone

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