Discussion:
Common Dialog in VB6
(too old to reply)
Tim
2004-05-27 23:16:01 UTC
Permalink
In VB6, Can I use a common dialog to only get a directory like C:\Test without any file name? Thanks.
Steven Burn
2004-05-27 23:20:29 UTC
Permalink
Forget the common dialog and do a search for SHBrowseForFolder instead.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.
Veign
2004-05-27 23:24:29 UTC
Permalink
Implementing the Browse For Folders Dialog
http://vbnet.mvps.org/code/browse/browsefolders.htm

Advanced Browse For Folders Dialog Features
http://vbnet.mvps.org/code/browse/browseadv.htm

FolderTreeview Control, Version 1.0
http://ccrp.mvps.org/controls/ccrpftv6.htm
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.
lance
2004-05-28 12:01:04 UTC
Permalink
wouldn't this CCRP control be more appropriate?

http://ccrp.mvps.org/controls/ccrpbdsvr6.htm

lance
Post by Veign
Implementing the Browse For Folders Dialog
http://vbnet.mvps.org/code/browse/browsefolders.htm
Advanced Browse For Folders Dialog Features
http://vbnet.mvps.org/code/browse/browseadv.htm
FolderTreeview Control, Version 1.0
http://ccrp.mvps.org/controls/ccrpftv6.htm
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.
Veign
2004-05-28 13:57:03 UTC
Permalink
Showing another option to Randy's code.

Just in case the OP wanted options for displaying a Folder tree.
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--
Post by lance
wouldn't this CCRP control be more appropriate?
http://ccrp.mvps.org/controls/ccrpbdsvr6.htm
lance
Post by Veign
Implementing the Browse For Folders Dialog
http://vbnet.mvps.org/code/browse/browsefolders.htm
Advanced Browse For Folders Dialog Features
http://vbnet.mvps.org/code/browse/browseadv.htm
FolderTreeview Control, Version 1.0
http://ccrp.mvps.org/controls/ccrpftv6.htm
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.
George Bashore
2004-05-27 23:40:10 UTC
Permalink
Tim try this.
1 form
1 commondialog
this code

Option Explicit

Private Sub Form_Load()
CommonDialog1.InitDir = "c:\test"
CommonDialog1.ShowOpen
End Sub
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.
That's not working George !!!!
2004-05-28 08:51:03 UTC
Permalink
That's not working George !!!!
George Bashore
2004-05-28 10:27:51 UTC
Permalink
Do you have a directory named test on c:\?
Post by That's not working George !!!!
That's not working George !!!!
Jeff Johnson [MVP: VB]
2004-05-28 12:59:24 UTC
Permalink
Post by George Bashore
Do you have a directory named test on c:\?
Are you reading the question correctly? The common dialog does not allow you
to SELECT a folder, only a file. You can ENTER a folder to browse its files,
but you cannot SELECT it.
MikeD
2004-05-28 00:14:53 UTC
Permalink
Post by Tim
In VB6, Can I use a common dialog to only get a directory like C:\Test
without any file name? Thanks.

You *can*, but that doesn't mean you *should*. There is a Browse For
Folders dialog box that you should use. However, there is no OCX included
with VB for this dialog box so you have to use the API to show it. Example
code is quite plentiful, though. Just search www.google.com for the
SHBrowseForFolder API function.

Mike
Kjell
2004-05-28 08:56:05 UTC
Permalink
The thing with SHBrowseForFolder sounds interesting, I'll try that....

However, I've made an workaround that goes like this

'Set FileName property to somethin
CommonDlg.FileName = "Our source files
and run it a
CommonDlg.ShowOpe

It works and users seems to grasp it..

Kjell
Continue reading on narkive:
Loading...