|
-
Aug 8th, 2000, 03:46 PM
#1
Thread Starter
Addicted Member
In a lot of VB code samples I see, paths for icons, graphics, databases, etc., are "hard-coded" into the control at design-time ("i.e. C:\VB6\Biblio.mdb").
But if the user decides to install the program on the D: drive, this will be a major problem. What's the right way to make sure your program will find its files no matter what drive or folder the user decides to install in?
-
Aug 8th, 2000, 03:49 PM
#2
Lively Member
This code returns the path of the exe file.
-
Aug 8th, 2000, 03:52 PM
#3
Thread Starter
Addicted Member
Boy that was easy! Thanks!
-
Aug 8th, 2000, 03:52 PM
#4
Addicted Member
Look up "App.Path" in VB help:
Code:
'App Path to open Database
'Set database name
Dim cDBName As String
cDBName = App.Path + "\SomeDataBase.mdb"
'Open db for exclusive use to see if anyone using it
Dim dbName As Database ' database object
Set dbName = OpenDatabase(cDBName, True)
'you would use similiar routines for files, pictures, etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|