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?
Printable View
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?
use the excellent code pulished by Gilles Roy from
http://www.codeguru.net/bbs/wt/showp...age=0&Limit=25
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
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
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