Get selected folder from Folder Browser Dialog using

Following example code demonstrate how to get selected path from folder browser dialog in

Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) Handles Button1.Click
        Dim SelectedPath As String = GetSelectedPath()
End Sub
Private Function GetSelectedPath() As String
        Dim objDlg As New FolderBrowserDialog
        Dim SelectedPath As String = ""
        'Set The Folderbrowserdialog Control Properties
        objDlg.Description = "Select Your  Folder"
        objDlg.RootFolder = Environment.SpecialFolder.MyDocuments
        objDlg.ShowNewFolderButton = True
        If objDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            SelectedPath = objDlg.SelectedPath
        End If
        'Clean Up
        objDlg = Nothing
        Return SelectedPath
End Function

2 thoughts on “Get selected folder from Folder Browser Dialog using”

Comments are closed.