My application wants to offer the client a range of options sets. Each set contains 60 options, variations on a theme. The sets are stored in a folder. Set1 set2 etc. I want to use a the folder browser to select a set but I don't want the user to see the whole drive. I want to set the root folder to the set parent. I have tried using RootFolder but I see that won't work. I also tried using the fileopenDialog but I can't select a folder. Is there a third option?
RootFolder sort of works when combined with SelectedPath
Using fbd As New FolderBrowserDialog
fbd.RootFolder = Environment.SpecialFolder.MyComputer
fbd.SelectedPath = "H:\temp\scans"
If fbd.ShowDialog = Windows.Forms.DialogResult.OK Then
MsgBox(fbd.SelectedPath)
End If
End Using
This at least displays the desired folder - all the other paths are still available if the user scrolls up.
This is the closest I've found searching the Internet using the standard OpenFileDialog:
Using obj As New OpenFileDialog
obj.Filter = "foldersOnly|*.none"
obj.CheckFileExists = False
obj.CheckPathExists = False
obj.InitialDirectory = "C:\temp"
obj.CustomPlaces.Add("H:\OIS") ' add custom location
obj.CustomPlaces.Add("H:\Permits") ' add custom location
obj.Title = "Select folder - click Open to return opened folder name"
obj.FileName = "OpenFldrPath"
If obj.ShowDialog = Windows.Forms.DialogResult.OK Then
MsgBox(IO.Directory.GetParent(obj.FileName).FullName)
End If
End Using
Edit CustomPlaces.Add() for your environment - these folders appear in the top right nav panel.
`obj.FileName = "OpenFldrPath"' is problematic - restrictions on what can be used eg a phrase fails.
Takes two clicks on Open to return the file path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.