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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Data DudeCommented:
(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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

leclairmCommented:
I think he wants to point to a server path that the application references.  Although I could be mistaken...
Gary2397Author Commented:
Yes, I want to point to a server path that the application references.
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.