473,511 Members | 15,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting a directory with the Common Dialog

Djeek
8 New Member
I tried to use the Common Dialog for choosing directories like many programs do but I did not manage it. You always have to select a file but I don't want to see/select files, only directories!
Earlier posts on this issue were not (proper) answered.
I searched the MSDN Library, Internet and this forum but found no answers...
Please...
Feb 17 '08 #1
10 9116
jamesd0142
469 Contributor
What version of vb are you using?

There is a:
"FolderBrowserDialog"
in vb 2005

which would solve you problem
Feb 18 '08 #2
debasisdas
8,127 Recognized Expert Expert
You can still use the VB 6.0

Try to find the location of the file using the CD control.

Try to remove file name part and you will get the directory.
Feb 18 '08 #3
Djeek
8 New Member
I tried to use the Common Dialog for choosing directories like many programs do but I did not manage it. You always have to select a file but I don't want to see/select files, only directories!
Earlier posts on this issue were not (proper) answered.
I searched the MSDN Library, Internet and this forum but found no answers...
Please...
Both thanks for reply.
Stripping the file from the path is no problem but I don't want to navigate files debasisdas.
That "FolderBrowserDialog" sounds interesting jamesd0142! I don't know it. Is it a custom control? Does it still exist in VB6? MSDN Library does not know it.
How can I invoke it? I'm using VB6 6.0.8169.
grts
Feb 18 '08 #4
jamesd0142
469 Contributor
Both thanks for reply.
Stripping the file from the path is no problem but I don't want to navigate files debasisdas.
That "FolderBrowserDialog" sounds interesting jamesd0142! I don't know it. Is it a custom control? Does it still exist in VB6? MSDN Library does not know it.
How can I invoke it? I'm using VB6 6.0.8169.
grts
I never used VB6 although I do know VB 2005 is a later version, much closer to VB.NET.

Im sure Killer42 would have an answer to your latest question however.

James
Feb 19 '08 #5
Djeek
8 New Member
Its disappointing not finding answers here... but all who repied: THANKS!
Mar 6 '08 #6
debasisdas
8,127 Recognized Expert Expert
Have you tried working on as suggested in Post #3
Mar 6 '08 #7
Djeek
8 New Member
I dont know if I have a CD control. I can not find such control in my VB6 installation. It isnt the multimedia control I suppose.
But... I (the user) dont want to have to choose a FILE at first and stripping it from the path. I even dont want show the files in the directories! Stripping the path is also possible with the standard Common Dialog!
Many programs offer the possibility to choose a DIRECTORY. Thats all, but HOW?
Mar 10 '08 #8
debasisdas
8,127 Recognized Expert Expert
Have you tried using Drive Listbox and directory listbox.
Mar 10 '08 #9
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

This code will allow you to select the Directory..

Expand|Select|Wrap|Line Numbers
  1.     With cdlg
  2.         .Flags = cdlOFNPathMustExist
  3.         .Flags = .Flags Or cdlOFNHideReadOnly
  4.         .Flags = .Flags Or cdlOFNNoChangeDir
  5.         .Flags = .Flags Or cdlOFNExplorer
  6.         .Flags = .Flags Or cdlOFNNoValidate
  7.         .FileName = "*.txyz"   'Dummy File
  8.         .CancelError = True
  9.         '
  10.         On Error Resume Next
  11.         .Action = 1
  12.         If Err = 0 Then
  13.             MsgBox Left(.FileName, Len(.FileName) - 7)
  14.         End If
  15.     End With
  16.  
This flag : cdlOFNNoValidate allows you to get the Browsed Path, even if no File is Selected

Regards
Veena
Mar 10 '08 #10
Djeek
8 New Member
I tried your common dialog settings Veena and it worked. Unfortunately is the dummy file not so nice.
At the end ;=) I followed your proposal to use the Drive and the Directory Listbox debasisdas!
My preference was the generic Windows Common Dialog...
All thanks for your help!
Mar 20 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

5
6485
by: John Lauwers | last post by:
Hello, Is there a way to move the commondialog to a specific position ? Greets John
6
1862
by: E Pease | last post by:
I have been trying to edit the Explorer example by Dev Ashish I found on www.msvp.org (I think). I have been all over the net so I am not quite sure where the file came from. I like the way it...
2
1812
by: Boris | last post by:
Hi, I have recently learned from a kind MVP that VS .NET 2002 won't use .NET framework 1.1 which in turn prevents me from utilizing the FolderBrowserDialog class since it is only available in...
3
4122
by: CaribSoft | last post by:
I want to create my own common dialog to use in an application . How do I show a custom dialog (form) in a class based on the common dialog class?
23
6956
by: George | last post by:
Is there a way to customize the open file common dialog? I am trying to modify the button text so I can create a delete file common dialog. I need the same functionality of the open file common...
4
2441
by: Ram Baruch | last post by:
Hi, I'm looking for a simple directory picker. I need both local drives directories and directories in the computers in the network neighborhood. Does anyone know if there is something ready in...
0
1363
by: Bo Gusman | last post by:
A curious problem, one that I think I've seen before. I have a .250 MLOC vb6 app that uses the common dialog control. If I select File/Open in my app to display the file open dialog and then...
6
1908
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a...
3
1500
by: =?Utf-8?B?SXZhbg==?= | last post by:
Hello. I'd like to ask, if there is some common dialog box for selecting directory (like CFileDialog class). Thanks.
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.