Forum guidelines
FolderBrowserDialog (how to use..?)
Posted on: 10 Apr 2006
hi to all, new to and i would just wanna ask on how to use the FolderBrowserDialog or anybody can show a snippet on how to do so on browsing the folders..



--winter world of iceblizzard
Re: FolderBrowserDialog (how to use..?)
Posted on: 11 Apr 2006  
Hi Iceblizzard
Its pretty simple, Create a new windows application, drag and drop FolderBrowserDialog control from toolbox, Probable its id will be "folderBrowseDialog1". Now add a button control and text box control to your form (just drag and drop). You can change their name too (As i changed their name to "btnClick" and "txtBrowseText". Now i am giving you a sample 2 line C# code on button click.

txtBrowseText.Text = folderBrowserDialog1.SelectedPath;

Change this C# Code to your VB.NET. Now when you will click to button, it will open folder browser control and you can select your desired folder. After clicking ok text box will show the selected path by folder browser dialog control.

Feel free to ask more ...

  • 0
  • 0
Re: FolderBrowserDialog (how to use..?)
Posted on: 30 Jul 2009  
Thanks man. Super easy, very helpful on getting the ball rolling!
Re: FolderBrowserDialog (how to use..?)
Posted on: 31 Jul 2009  
FolderBrowseDialog fd  = new FolderlBrowseDialog();

if ( fd.ShowDialog() == Dialog.Result.Ok)

string selectedFolder = fd.SelectedPath;
//Do Something




Re: FolderBrowserDialog (how to use..?)
Posted on: 22 Feb 2010  
thx, that is really useful

Re: FolderBrowserDialog (how to use..?)
Posted on: 14 Apr 2010  
I am trying to code so that my root folder shows if the user chooses cancel but I can't seem to figure it out.  Any assistance?  My code is below.

  Dim dlgSetFolderLocation As New FolderBrowserDialog

        ' User instructions.
        dlgSetFolderLocation.Description = "Please select a folder for the download."

        ' Disable NewFolder option.
        dlgSetFolderLocation.ShowNewFolderButton = False

        ' Set root folder where user starts browsing.
        dlgSetFolderLocation.RootFolder = Environment.SpecialFolder.Desktop

        ' Path user selects.
        dlgSetFolderLocation.SelectedPath = My.Computer.FileSystem.SpecialDirectories.Desktop

        ' If the user clicks OK button..
        If dlgSetFolderLocation.ShowDialog = DialogResult.OK Then

            ' Show user path in lblFolderLocation
            Me.lblFolderLocation.Text = dlgSetFolderLocation.SelectedPath
            ' If user selects cancel, show root path in lblFolderLocation

        End If
    End Sub


Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.