Place the button on the form, handle the click event, and use the FolderBrowserDialog .
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Using fld As New FolderBrowserDialog() If fld.ShowDialog() = Windows.Forms.DialogResult.OK Then MessageBox.Show("Selected " & fld.SelectedPath) End If End Using End Sub
To select a file, use the OpenFileDialog class:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Using ofd As New OpenFileDialog() If ofd.ShowDialog() = DialogResult.OK Then MessageBox.Show("Selected " + ofd.FileName) End If End Using End Sub
source share