Results 1 to 4 of 4

Thread: What do I do if they don't install in C:\?

  1. #1

    Thread Starter
    Addicted Member P.S.W.'s Avatar
    Join Date
    Aug 2000
    Posts
    146
    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?


  2. #2
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72
    Code:
    App.Path
    This code returns the path of the exe file.

  3. #3

    Thread Starter
    Addicted Member P.S.W.'s Avatar
    Join Date
    Aug 2000
    Posts
    146
    Boy that was easy! Thanks!

  4. #4
    Addicted Member
    Join Date
    Jan 1999
    Posts
    239

    Talking

    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
  •  



Click Here to Expand Forum to Full Width