28 | 04 | 2017

Using the Folder Browse Dialog

In Visual Studio add a FolderBrowseDialog to a Windows Form.

FolderBrowseDialog

The add a Button (Button1) and a textbox (TextBox1) to the form.

Form1

Then add the following code to the button.

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
'***********************************
'*** Code From VisibleVisual.com ***
'***********************************

Dim Folder As String
     
'Specify the root folder this example is set to the MyComputer

FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer

Folder = FolderBrowserDialog1.ShowDialog()
  
'Display the selected folder into a textbox
    
TextBox2.Text = FolderBrowserDialog1.SelectedPath
 
End Sub


Now run the code and hit the button. You will see the following window

Select Folder

 

Select a folder and the path will be displayed into the textbox.

 

 

{jcomments on}

 

Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2236196
Latest Articles