473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to set OpenFileDialog to "My Computer"

Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks

Nov 2 '06 #1
8 12160
The "My Computer" folder isn't a real directory, so you can't access it using
normal directory methods. In Visual Basic 2005, you can access all of the
drives through the My.Computer.FileSystem.Drives collection.

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks

Nov 2 '06 #2
Oops, I misread your post. Sorry for the useless information.

You have to use the ID of the folder to access it. This article gives the
details.

http://msdn.microsoft.com/msdnmag/is...3/CuttingEdge/

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks

Nov 2 '06 #3
Thanks for that. I'm not sure I want or need to go to quite that
length, but I'll try to take it all in.
Tim Patrick wrote:
Oops, I misread your post. Sorry for the useless information.

You have to use the ID of the folder to access it. This article gives the
details.

http://msdn.microsoft.com/msdnmag/is...3/CuttingEdge/

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks
Nov 2 '06 #4
You could try My.Computer.FileSystem.SpecialDirectories.Desktop. At least
from there, they can easily choose "My Computer".
Robin

"Steve Marshall" <st****@westnet.net.auwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Thanks for that. I'm not sure I want or need to go to quite that
length, but I'll try to take it all in.
Tim Patrick wrote:
>Oops, I misread your post. Sorry for the useless information.

You have to use the ID of the folder to access it. This article gives the
details.

http://msdn.microsoft.com/msdnmag/is...3/CuttingEdge/

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks

Nov 2 '06 #5
Thanks Robin, but at the moment I'm a VS2003 user, and I think
My.Computer... is a VS2005 and/or Framework 2 feature.
RobinS wrote:
You could try My.Computer.FileSystem.SpecialDirectories.Desktop. At least
from there, they can easily choose "My Computer".
Robin

"Steve Marshall" <st****@westnet.net.auwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Thanks for that. I'm not sure I want or need to go to quite that
length, but I'll try to take it all in.
Tim Patrick wrote:
Oops, I misread your post. Sorry for the useless information.

You have to use the ID of the folder to access it. This article gives the
details.

http://msdn.microsoft.com/msdnmag/is...3/CuttingEdge/

-----
Tim Patrick
Start-to-Finish Visual Basic 2005

Hi All,

Is it possible to set the InitialDirectory property of an
OpenFileDialog so it will open at the "My Computer" level? I want it
to open showing all the available drives. If so, what do I put in the
property? I've tried the obvious - "My Computer", but of course that
doesn't do it.

Thanks
Nov 3 '06 #6
Steve Marshall wrote:
Thanks Robin, but at the moment I'm a VS2003 user, and I think
My.Computer... is a VS2005 and/or Framework 2 feature.
Then you'll be after GetFolderPath(Environment.SpecialFolder.MyComputer ).

HTH

Andrew
Nov 3 '06 #7
"Andrew Morton" <ak*@in-press.co.uk.invalidschrieb:
>Thanks Robin, but at the moment I'm a VS2003 user, and I think
My.Computer... is a VS2005 and/or Framework 2 feature.

Then you'll be after GetFolderPath(Environment.SpecialFolder.MyComputer ).
.... which won't be very useless because the path assigned to 'MyComputer' is
"".

What you can try instead (untested!):

\\\
Const STR_MYCOMPUTER_CLSID As String =
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
fbd.InitialDirectory = "::" & STR_MYCOMPUTER_CLSID
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 3 '06 #8
Works beautifully - many thanks Herfried, and all other respondents
too.
Herfried K. Wagner [MVP] wrote:
"Andrew Morton" <ak*@in-press.co.uk.invalidschrieb:
Thanks Robin, but at the moment I'm a VS2003 user, and I think
My.Computer... is a VS2005 and/or Framework 2 feature.
Then you'll be after GetFolderPath(Environment.SpecialFolder.MyComputer ).

... which won't be very useless because the path assigned to 'MyComputer' is
"".

What you can try instead (untested!):

\\\
Const STR_MYCOMPUTER_CLSID As String =
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
fbd.InitialDirectory = "::" & STR_MYCOMPUTER_CLSID
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 6 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pavel | last post by:
Greetings to all - I'm having a problem processing xml with relative dtd URI specified using XSLT: <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE mydoc SYSTEM "my.dtd"> <mydoc> .......
0
by: Grant_S | last post by:
I need to identify the path to a users "My Document" folder where the user has a roaming profile and their "My Documents" folder is mapped to a network share as the H drive (specifically H:\\ -...
4
by: yaipa | last post by:
All, I've been asked by my boss to put an Icon in WinXP's "My Computer" for a utility we use around the shop. My tool of choice is of course Python and therefore what I am using to attempt my...
6
by: JuLiE Dxer | last post by:
Is there a way via C# to programmatically retrieve the full path name to folders like "My Documents" ?? I'm seeing examples with the use of Shell32 stuff I believe, SHGetSpecialFolderLocation...
1
by: mnlarsen | last post by:
How do I set the default location to "My Computer" when using the GetOpenFileName call? I have tried the following but CSIDL_DRIVES doesn't appear to work. Any ideas? WCHAR szFile =...
8
by: Just Me | last post by:
1)How can I find the folders like "My Recent Document", "Desktop", "My Pictures",... if I want to store a file there? 2) How can I find the icon for those files if I want to display it? ...
0
by: Renster | last post by:
Folks, Im writing a class library which I need to access a connected device's (phone) memory via UNC or something alone those lines, but cant work out out to do it, eg "\\my computer\nokia...
7
by: tman69 | last post by:
I apologize in advance for the length of this posting and will attempt to simplify as much as possible. I have an automation application in MS Access which generates reports in Excel and emails...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.