Browse for folders dialog

  • Thread starter Thread starter google
  • Start date Start date
G

google

Hi

Does anyone know a way of showing an open folder dialog, as if being
opened on a remote computer?

e.g. When you go to create a new database in SQL Server Enterprise
Manager and browse for where you wish to put the data files a browse
dialog appears using the drives/folders of the remote server, not your
local machine.

Any idea as to how this is done?

Thanks
Russell Mason
 
Hi

To my knowledge, the FolderBrowserDialog only shows folders/paths that
are available from the local machine. If a server has a share you can
get to it through the share name, however this is not what I'm after. I
would like to see C:\..., D:\... as if the dialog had been opened on
the server, this would be different from the structure shown on the
local machine. Again the only example of this I can point to is the way
SQL Server Enterprise Manager does it with new database files.

If the FolderBrowserDialog can do this then I would be greatful if you
could let me know how to set it up to use a file structure on another
machine.

Thanks
Russell Mason
 
Russell,

Ah, I missed the remote part--sorry about that. I'm not aware of any
component that does that (except for the SQL dialog that you
mentioned).
You could write your own, but it would take a bit of time.

Is there a service or program running on the remote system? You would
need some way to populate the dialog with the folder structure from the
remote. Or, you could rely on the calling function having enough
rights to enumerate the folder structure remotely (but that may not be
possible).

Sounds like a fun challenge!

-- Tim Scott
http://geekswithblogs.net/tscott
 
Hi

Just in case anyone wants to do the same I have found a solution.

I forgot to say I wanted to do this IN SQL Server, not just LIKE SQL
Server (Sorry Tim). I thought there may be a Windows Dialog for this
already but its really a database question.

Have a look at xp_availablemedia and xp_dirtree. These extended stored
procs allows you to get drive/folders structures (assuming you have the
correct SQL permissions). This is how SQL Enterprise Manager does it.
The UI part is down to me!

Thanks
Russell Mason
 
Hey Russell,

I'm pretty sure that's not possible with FolderBrowserDialog. You obviously
should have something running on the remote machine that would tell you its
local file system structure. SQL Server does this behind the scenes, but
you'll have to come up with your own solution (possibly .NET
Remoting-based).
 
Russell,

The UI part sounded fun. I started on a prototype before seeing your post
about the stored procs in SQL Server. Good to know, by the way.

Anyway, I've done a prototype UI that is decoupled from the logic that
actually gets the file and folder list. Right now it's listing local files
and folders, but you could move that code to pull from the SQL stored procs,
or get it via remoting.

You can download from
http://projectdistributor.net/Releases/Release.aspx?releaseId=313

There is much todo to make it ready for prime time, but enjoy!

-- Tim Scott
http://geekswithblogs.net/tscott
 
Back
Top