Assigning Drive Letter in VB6

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2006
Posts: 2
Reputation: PaulCC is an unknown quantity at this point 
Solved Threads: 0
PaulCC PaulCC is offline Offline
Newbie Poster

Assigning Drive Letter in VB6

 
0
  #1
Nov 29th, 2006
Is there a method that VB uses to get the drive letter of the directory where the program files reside witout specifying it explicitly? :rolleyes:
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 18
Reputation: Sentax is an unknown quantity at this point 
Solved Threads: 2
Sentax Sentax is offline Offline
Newbie Poster

Re: Assigning Drive Letter in VB6

 
0
  #2
Nov 29th, 2006
If I understand correctly. You can use the stored system variables:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Debug.Print Environ("PROGRAMFILES")
  2.  
  3. 'OR if you want just the drive letter you can also use
  4.  
  5. Debug.Print Environ("HOMEDRIVE")
  6.  
  7. 'OR
  8.  
  9. Debug.Print Environ("SYSTEMDRIVE")
Find a large list of these variables here and what they are all about: http://vlaurie.com/computers2/Articles/environment.htm
Last edited by Sentax; Nov 29th, 2006 at 6:44 pm. Reason: Added more information.
It is the wisest man who knows there is much he does not know.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 2
Reputation: PaulCC is an unknown quantity at this point 
Solved Threads: 0
PaulCC PaulCC is offline Offline
Newbie Poster

Re: Assigning Drive Letter in VB6

 
0
  #3
Nov 29th, 2006
The path where the project file resides can be gotten (as a string) using App.Path
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Assigning Drive Letter in VB6

 
0
  #4
Nov 30th, 2006
Hi,

Use

MsgBox "My program Is In drive : " & Left(App.Path,1)

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC