Link to home
Create AccountLog in
Avatar of Gary2397
Gary2397

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of leclairm
leclairm

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.
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
I think he wants to point to a server path that the application references.  Although I could be mistaken...
Avatar of Gary2397

ASKER

Yes, I want to point to a server path that the application references.
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.