Murray Brown
asked on
VB.net set specific folderfor FolderBrowserDialog
Hi
How do I set a custom or specific RootFolder for the FolderBrowserDialog1. I want to specify a very specific location
held in a text variable.
Thanks
How do I set a custom or specific RootFolder for the FolderBrowserDialog1. I want to specify a very specific location
held in a text variable.
Thanks
check http://www.csharp411.com/set-initialdirectory-for-folderbrowserdialog/
ASKER
Thanks Eric, but I had worked out the .SelectedPath file part. I know that the following line is incorrect but I want to be able to set the RootFolder to a specific path
dialog.RootFolder = "C:Program Files"
I need to set the RootFolder to this before the user makes any selection
Or am I missing something
dialog.RootFolder = "C:Program Files"
I need to set the RootFolder to this before the user makes any selection
Or am I missing something
to which path do you want the dialog to open?
a backslash is missing:
Dim dialog As New FolderBrowserDialog
dialog.RootFolder = Environment.SpecialFolder.Desktop
dialog.SelectedPath = "C:\Program Files"
If (dialog.ShowDialog() = DialogResult.OK) Then
MessageBox.Show(dialog.SelectedPath)
End If
ASKER
I want the dialog to open at the root folder. If you specify the .SelectedPath you often have to scroll down to see that it is selected whereas the RootFolder will automatically scroll down. In my program the RootFolder needs to be able to be any path, not just the special options you get.
and what is your root folder set at?
ASKER
The folder path held in a string could be anything so I don't set the root folder to any of the given options
As an example I want my root folder to be "C:\Users\murbr\Dropbox\Le sedi Automations\Automator"
If I specify FoldBrowserDialog1.Selecte dPath = "C:\Users\murbr\Dropbox\Le sedi Automations\Automator"
I see the following
I then have to scroll down to see
I don't want the user to have to scroll down. I want it to be obvious to them that they are at that location. The root folder would do this but I don't know how to set it to to
"C:\Users\murbr\Dropbox\Le sedi Automations\Automator"
As an example I want my root folder to be "C:\Users\murbr\Dropbox\Le
If I specify FoldBrowserDialog1.Selecte
I see the following
I then have to scroll down to see
I don't want the user to have to scroll down. I want it to be obvious to them that they are at that location. The root folder would do this but I don't know how to set it to to
"C:\Users\murbr\Dropbox\Le
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 very much Eric. Great answer! Worked perfectly.