Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to dynamically replaced the hardcoded drive letter/path?

Status
Not open for further replies.

tincan56

MIS
Feb 18, 2002
24
US
HI!
I have a small visual basic 6 program that parses data.
Currently, my drive is hardcoded with the drive letter and path (Ex. Private Const DIRDRIVE = "J:\" and Private Const BACKUPDIR = "J:\Application Support\Process\Backup"). This however, causes a problem because the user does not have the same letter drive that is hardcoded in the program, therefore he is unable to use it (he is not willing to change the path to J: drive either).

Can anyone give me some ideas of how to approach this issue? Should i be looking at VB's File System objects in order to complete this issue?

Thanks so much!
 

You can do 3 different things...

1. Depend upon the user to point your program to the correct path based upon their machine.

2. Have your NA/SA or one of their people to write script that automatically maps everyone to that drive letter (Will cause problems if they are using that letter.).

3. Use the UNC path in your program (\\server\share\directory\file)

Good Luck

 
Set the drive letter to a variable.

Have the user enter the drive letter the first time it is needed.

Use the save setting and getsetting funstions to store the drive letter in the registry and get the drive letter from the registry to feed the fore mentioned variable.

This will allow each target computer to have its own drive letter, if needed and the user will only have to enter it once.

You can do the same for an entire path and use the common dialog control to determine the path the first time the user needs it. Then put it in the registry until the user needs to change it. Thanks and Good Luck!

zemp
 
I agree with vb5prgrmr in using the unc, if you absolutly need a mapped drive then you could check the available drives by each start and map a free drive to work with. After the work is finished you could then remove the temp mapped drive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top