There is a way to do this but Microsoft really should have added the "Folder Only" option to the "OpenFileDialog"
Here's how I was able to do it (With the help of a post on another site)
First you have to add two references to your project
(Click on Project->Add Reference...)
under the .NET tab add these two references
System.Windows.Forms.Dll
and
System.Design.Dll
Next create a new class and name it BrowseForFolder (BrowseForFolder is what I chose to name it, you can name it whatever you want)
copy this code into the BrowseForFolder Class
Public Class BrowseForFolder
Inherits System.Windows.Forms.Design.FolderNameEditor
Dim bDialog As New FolderBrowser()
Public Function BrowseDialog(ByVal sTitle As String)
With bDialog
.Style = FolderBrowserStyles.BrowseForEverything
.StartLocation = FolderBrowserFolder.Desktop
.Description = sTitle
.ShowDialog()
BrowseDialog = .DirectoryPath()
End With
End Function
End Class
Now comes the easy part.
In your form use the code like this
Private Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Browse1.Click
Dim MyFolder As String
Dim myDialog As New BrowseForFolder()
MyFolder = myDialog.BrowseDialog("This text will be displayed at the top of the browse dialog. Change this to whatever you want"
End Sub
That's it. Here when the Button is clicked it opens a browse window and the result is saved in the variable MyFolder.
Note: If the user clicks cancel, the dialog returns "" so you might want to write code to accomodate this.