How to select folder directory in vb.net

How to select folder directory
=====================================================================================
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
' First create a FolderBrowserDialog object
Dim FolderBrowserDialog1 As New FolderBrowserDialog
' Then use the following code to create the Dialog window
' Change the .SelectedPath property to the default location
With FolderBrowserDialog1
' Desktop is the root folder in the dialog.
.RootFolder = Environment.SpecialFolder.Desktop
' Select the C:\Windows directory on entry.
.SelectedPath = "c:\"
' Prompt the user with a custom message.
.Description = "Select the source directory"
If .ShowDialog = Windows.Forms.DialogResult.OK Then
' Display the selected folder if the user clicked on the OK button.
Lblpath.Text = .SelectedPath
Else
MessageBox.Show("Select directory")
End If
End With
End Sub
=====================================================================================

No comments: