FolderBrowserDialog Control in Visual Basic .NET

Last Updated: March 19, 2020

Using FolderBrowserDialog you can select the folder instead of file. This only displays folder so you can browse the folder structure and select what you need

Following figure show the Folder Browser Dialog


Now we will try to implement the following form. It will browse the folders and select the folder to display in TextBox


This is the completed code for above Form

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        With FolderBrowserDialog1
            .Description = "Select Output Path"
            .RootFolder = Environment.SpecialFolder.MyComputer
        End With

        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            TextBox1.Text = FolderBrowserDialog1.SelectedPath
        End If
    End Sub
End Class