curmudgeon42
asked on
Browse for Directory in VB.NET
I need to have the user pick a directory on the hard disk, not a file. Can you do this with an OpenFileDialog? Do you need another control? What control? Can you include a snippet of code to show me how to create this directory picker?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks that was perfect.
Imports System.Windows.Forms.Desig
Public Class clsSpFolderBrowser
Inherits FolderNameEditor
Dim mo_FB As New FolderBrowser()
Public Sub New()
MyBase.new()
mo_FB.Style = FolderNameEditor.FolderBro
mo_FB.StartLocation = FolderBrowserFolder.Deskto
End Sub
Public Sub ShowDialog()
mo_FB.ShowDialog()
End Sub
Public ReadOnly Property DirectoryPath() As String
Get
Return mo_FB.DirectoryPath
End Get
End Property
Public WriteOnly Property Description() As String
Set(ByVal Value As String)
mo_FB.Description = Value
End Set
End Property
End Class
Dim po_FolderBrowser As New clsSpFolderBrowser()
po_FolderBrowser.Descripti
po_FolderBrowser.ShowDialo
If po_FolderBrowser.Directory
x = po_FolderBrowser.Directory
End If