[Last Call] Learn how to a build a cloud-first strategyRegister Now


FolderBrowserDialog Will Show "My Recent Documents' By Default

Posted on 2007-10-06
Medium Priority
Last Modified: 2012-05-05
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?
Question by:Asparona
  • 2

Expert Comment

ID: 20028272
I replicated your sequence of steps. Unlike your case, if I do not specify the root folder, it opens up in My Documents by default.

Can you post your code for a closer look?

Accepted Solution

Asparona earned 0 total points
ID: 20028769
Thanks for your response.

I took a closer look myself before replying and I was able to test a bit more.  I have found that one problem is the control will not navigate to the "My Documents" folder on my computer. It appears to be related to the path having spaces in it. I can navigate deeply in the directory tree (e.g. "C:\Inetpub\wwwroot\BOI\Production merchant site\images\_vti_cnf") so long as the directory names do not have spaces in them.

When i try to navigate to the 'My Documents" folder it fails (e.g. "C:\Documents and Settings\firstname lastname\My Documents"). I assuming it is related to so many directories with spaces in the name.

So, when it couldn't navigate to the directory it defaulted to the "recent" directory. By specifying "My Computer" as the RootDirectory I can get it to default to an acceptable directory  (when it can't get to the  directory I specify).

This has resolved my problem or answered why it wasn't working as expected.

Thanks for your input.


Author Comment

ID: 20036135

Yes I resolved the question myself. Can you refund the points?

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question