VB6 Directory Path

I have a VB6 application that has a DriveListBox, DirListBox, and FileListBox. Currently in the application I have hard coded the directory path for the DriveListBox and the DirListBox for the directory I have mapped on my machine. The DriveListBox and DirListBox point to files in an application folder on the mapped directory. Now, this application will be distributed to other users. Not every user will have the same drive letter as my mapped directory. Is there a way to program to where the directory can be located and not dependant upon the drive letter.

The current code is:

Private Sub Form_Load()
Dir1.Path = "G:\data\reports"
Drive1.Drive = "G"
End Sub
Gary2397Asked:
Who is Participating?
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
(Wild guess)  You could try feeding it the UNC path, as in Dir1.Path = "\\Server\data\reports", and let the user's pc figure out which drive letter it is.

Also, it wouldn't be a bad idea to validate if that share exists on the target pc first.  Something like using fso.
0
 
leclairmCommented:
Also, you should store the path the user selects in an ini file.

You use the WritePrivateProfileString and GetPrivateProfileString api's to write/read values with ini files.
0
 
KnobiKnobiCommented:
i think "App.Path" returns the path you are looking for
but Attention: This is the path of the "EXE" file. So in IDE (during debugging) this points to the VB installaion path, but compiled it works like expected
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
leclairmCommented:
I think he wants to point to a server path that the application references.  Although I could be mistaken...
0
 
Gary2397Author Commented:
Yes, I want to point to a server path that the application references.
0
 
aikimarkCommented:
if you know at least one of the files in the directory, you could iterate the mapped drives (via FSO object) and look for this file.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.