Click to See Complete Forum and Search --> : Selecting Directory in Common Dialog Box


mmforrester
August 20th, 1999, 05:52 AM
How can I select a directory from the Common Dialog Box. It only allows me to select a file. Am I using the wrong control, or are some of my settings incorrect?

Lothar Haensler
August 20th, 1999, 06:29 AM
use the excellent code pulished by Gilles Roy from
http://www.codeguru.net/bbs/wt/showpost.pl?Board=vb&Number=3595&Search=true&Forum=vb&Words=BrowseFolder&Match=Substrings&Topic=&Searchpage=0&Limit=25

Chris Eastwood
August 20th, 1999, 07:56 AM
Ooops!

I was supposed to post that onto the site wasn't I ? I'll get onto it tonight and let you all know where it is.



Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb

Chris Eastwood
August 20th, 1999, 08:17 AM
I've added the article/code at :

http://www.codeguru.com/vb/articles/1864.shtml




Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb

hiran
August 30th, 1999, 01:46 PM
Hi,

If I were you, I'd do the following:

VB provides 3 special controls named, disklistbox,directorylistbox,filelistbox.You can add those controls to your tool box. They 'll search the drives and directories automatically.Add those 3 controls to your form and You need to connect them by the following code.

Sub Drive1_change( )
Dir1.path = Drive1.drive
End sub

Sub Dir1_change( )
File1.path = Dir1.path
End Sub

Sub File1_DblClick( )
On Error GOTO File Error
if (Right$(Dir1.path,1) = "\") then
Filename$ = Dir1.path + File1.filename
else
Filename$ = Dir1.path + "\" + File1.filename
endif
............
............
File ERROR:
Msgbox "File ERROR",48,"dialog box" ' Msg box for file error
resume
End Sub