Results 1 to 5 of 5

Thread: [2005] FolderBrowserDialog limit to a drive

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    172

    [2005] FolderBrowserDialog limit to a drive

    Hi, is there a way to limit the FolderBrowserDialog to a drive like d: so that the user can only choose a folder in that drive
    Thanks

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] FolderBrowserDialog limit to a drive

    I dont think so. You'd be best off creating your own custom FolderBrowseDialog that implements this functionallity.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Addicted Member Crushinator's Avatar
    Join Date
    Jan 2006
    Location
    The Dark Side of the Moon, MD
    Posts
    179

    Re: [2005] FolderBrowserDialog limit to a drive

    Hello, set the RootFolder property of the FolderBrowserDialog to whatever location you need. Whatever you specify as the Root, the user cannot navigate any higher.

    IE
    Code:
      FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.ApplicationData
      FolderBrowserDialog1.ShowDialog()
    The user can now not navigate higher than the AppData folder in the dialog box.
    Using Framework 2.0, VB.Net 2005.

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [2005] FolderBrowserDialog limit to a drive

    Quote Originally Posted by Atheist
    I dont think so. You'd be best off creating your own custom FolderBrowseDialog that implements this functionallity.
    You really should do your homework...

    Quote Originally Posted by Crushinator
    Hello, set the RootFolder property of the FolderBrowserDialog to whatever location you need. Whatever you specify as the Root, the user cannot navigate any higher.

    IE
    Code:
      FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.ApplicationData
      FolderBrowserDialog1.ShowDialog()
    The user can now not navigate higher than the AppData folder in the dialog box.
    To back this up: http://msdn.microsoft.com/en-us/libr...er(VS.80).aspx
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] FolderBrowserDialog limit to a drive

    The problem is that the RootFolder property only accepts a SpecialFolder value, which does not include specific drives. If this is possible you would have to do it through unmanaged code I think.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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