What a stupid design of FolderBrowserDialog

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

If I'm not stupid for this, then the design of FolderBrowserDialog is very
stupid. It only allow to strat browing from several predefined
folder(Environment.SpecialFolder). What can I do if I want to start from any
folder I want?
 
Fei said:
Hi,

If I'm not stupid for this, then the design of FolderBrowserDialog is very
stupid. It only allow to strat browing from several predefined
folder(Environment.SpecialFolder). What can I do if I want to start from any
folder I want?

That's not what the RootFolder property means. The RootFolder property
just tells the dialog what shell namespace it should be operating in,
such as if you wanted to limit the browsing to only My Documents. It
prevents the user from browsing *outside* of that special folder.

The SelectedPath property, which is a string, can be set to any path
that exists underneath the RootFolder special folder. That's the path
that appears initially when the dialog is opened.

--Mike
 
It will not make things any better because "SelectedPath" must be underneath
the "RootFolder". Why not strat from any folder I want, for example, my
application running folder?
 
Fei said:
It will not make things any better because "SelectedPath" must be underneath
the "RootFolder". Why not strat from any folder I want, for example, my
application running folder?

I'm not sure I follow what the problem is. You set your root folder to
SpecialFolder.Desktop, and your SelectedPath to whatever path you want
to start browsing at. Since basically the entire computer is under the
Desktop, you can browse to anything you want.

--Mike
 
How can I make it work if the user installs my application ***not underneath
the RootFolder special folder*** ? Let me remind you the RootFolder special
folder does not include disk root.
 
wrong! The desktop I got is the folder "disk:\Documents and Settings\my
name\Desktop". Nothing underneath.
 
Fei said:
wrong! The desktop I got is the folder "disk:\Documents and Settings\my
name\Desktop". Nothing underneath.

That is SpecialFolder.DesktopFolder, not SpecialFolder.Desktop. They
are different.

The Desktop contains My Documents, My Computer, My Network Places, etc.
In other words, the entire file system.

--Mike
 
How are they going to know what the RootFolder is going to be?
Your application can determine this dynamically at runtime...you don't need
to set it once and for all in the properties window of the form designer.
You can find out what the current directory is by using
Environment.GetCurrentDirectory(), and I'm sure there's some way of getting
the path of the folder that the EXE is living in. If you don't know how to
retrieve this information at runtime, then you need to start a more specific
thread with this question. But it is something you need to find out at
*runtime*, i.e. *after* the user has installed your application.

Read this... and progress... don't let this thread go round in circles...
 
Is there a way to limit the user access to only certain drives on the
computer, not the complete system and network drives?
 
Back
Top