FolderBrowserDialog Will Show "My Recent Documents' By Default
Posted on 2007-10-06
I have recently included a BrowseFolderDialog control to my app. During testing I noticed it would open up to the "My Computer" directory by default.
To test the functionality of the control I changed the root folder to "recent"
Me.FolderBrowserDialog.RootFolder = Environment.SpecialFolder.Recent
After running the program to see what I would get, I then changed it back to "My Computer"
Me.FolderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer
What I wanted to do was to open the control in a specific directory. I've sense learned that in order to get the control to show a specific directory what I needed to do was to type in the directory I want to in to the "SelectedPath" property.
Me.FolderBrowserDialog.SelectedPath = "c:/mydirctory".
However, the problem is every since I specified the RootFolder to be "recent", if I do not specify a specific RootFolder the control will open up in the "My Recent Documents" Directory. I.e setting the SelectedPath does nothing and I must choose some other RootFolder setting to get it to open in another folder other than "My Recend Documents" directory.
I have set FolderBrowserDialog.RootFolder to several different settings, I have rebooted numerous times and I have searched the registry for "RootFolder" (and found nothing). Nothing I have tried will change it from trying to open the "My Recent Documents" directory (unless I specify another RootFolder like "My Computer").
What I want is to open a specific directory when the control opens and not something from the "RootDirectory" property.
Any ideas on why it is stuck on "My Recent Documents" directory?