FolderBrowserDialog
FolderBrowserDialog is used to ask the user to select a folder.
fbd is an object of FolderBrowserDialog class which is used to call different functions contained in the FolderBrowserDialog class.
.ShowNewFolderButton sets a value whether new folder button will appear in the FolderBrowserDialog.
.RootFolder sets the folder from where the browsing starts.
.Description sets the text which should be displayed in the FolderBrowserDialog.
.SelectedPath gets or sets the path which is selected by the user.
.ShowDialog() function shows the FolderBrowserDialog box.
Code:
Public Function openFolder() As String
Dim name As String = String.Empty
Dim fbd As New FolderBrowserDialog
With fbd
.ShowNewFolderButton = False
.RootFolder = Environment.SpecialFolder.Desktop
.Description = "Select"
.SelectedPath = "C:\"
If .ShowDialog = Windows.Forms.DialogResult.OK Then
name = .SelectedPath
End If
End With
Return name
End Function
0 comments:
Post a Comment