Question

Using VS2013 with VB.NET and using the FileBrowseDialog(), I can't seem to see the property to have it use either the last location selected OR be able to specify a directory to start in based on the contents of a text box.

The code works great for opening and posting the .SelectedPath where I need it but now I want it to start in a specific location.

Tried .ROOT but that doesn't seem to allow me to specify a starting position other then an enumerated value.

Thoughts?

Was it helpful?

Solution

Did you try to set the SelectedPath before trying to open the FolderBrowserDialog?

Dim fbd = new FolderBrowserDialog()
fbd.SelectedPath = "your path variable"
if fbd.ShowDialog() = DialogResult.OK Then

   string newPath = fbd.SelectedPath
   .....

From MSDN FolderBrowserDialog.SelectedPath

If the SelectedPath property is set before showing the dialog box, the folder with this path will be the selected folder, as long as SelectedPath is set to an absolute path that is a subfolder of RootFolder (or more accurately, points to a subfolder of the shell namespace represented by RootFolder).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top