Open a Directory

  • Thread starter Thread starter Mike Fellows
  • Start date Start date
M

Mike Fellows

im trying to open a directory (as if i had browsed to the directory in
windows) from code

im checked system.io.directory but there doesnt seem to be an open command
(or similar)

is there an easy way to do this?

thanks

Mike Fellows
 
Hi Mike,

I assume you are looking for the folderbrowserdialog which is in Net 1.1

Before Herfried says it there is a bug in it from which I understand that it
can set your program totally out of scope when the paths have more than 128
characters.

Cor
 
Hi Cor,

how on earth do i use this - ive found it in system.windows.forms
but i seem unable to get anything from it

i simply want to open c:\test folder

but cant seem to get it to do this

Thanks

Mike
 
Cor,

thats seems way over complicated just to do what i want

say i had a folder (c:\myfolder)

to get to that normally i would click

mycomputer
c:
myfolder

and i would have a folder showing all the files within c:\myfolder

i just want to open that folder from code

hope that helps

Mike
 
Hi Mike,

Dim fd As New FolderBrowserDialog
fd.SelectedPath = "c:\myfolder"
fd.ShowDialog()
(That folder must exist when you do it this way)

Do you mean this?

Cor
 
Hi Cor,

Sadly not

erm i want to basically use explorer.exe

the normal windows browser i just want to show some files my code has just
created

i dont want to select any files i just want to show that there there to the
user

your help is much appreciated on this

Mike
 
Armin,

Thanks that was exactly what i wanted

although........

if i call explorer.exe it works a treat and does what i wanted only it opens
"My Documents"

if i call "explorer.exe c:\"

i get "The System Cannot Find The Specified File"

if i call "explorer.exe /n,/root,c:\"

i get the same error message - i seem unable to specify a directory - i must
be doing something silly as im stumped by this

Thanks

Mike
 
Mike Fellows said:
Thanks that was exactly what i wanted

although........

if i call explorer.exe it works a treat and does what i wanted only
it opens "My Documents"

if i call "explorer.exe c:\"

i get "The System Cannot Find The Specified File"

if i call "explorer.exe /n,/root,c:\"

i get the same error message - i seem unable to specify a directory -
i must be doing something silly as im stumped by this

This works here:

Process.Start("explorer.exe", "/n,/root,c:\")


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top