When I used messagebox like this MsgBox App.Path, It pop up the messagebox like this like this C:\PF\GUI . I don't want the location dependency to run this Mxd files. How to do that? My exe program in this location C:\PF\GUI
I run from Microsoft project. I will later deploy my program so I don't want my program dependency with the path location to avoid error message. So How to make the program able to run in any directory?
If I retain this path location, So during installation, I have to choose the directory I want to install the program, So If I change this directory to other directory during installation, for example in "C:\Project\, which directory the this link will deploy to? in C:\Project\ or in this C:\PF\Modeling
File10=@Precision Farming.mxd,C:\PF\Modeling,,,1/25/08 11:22:50 AM,7176192,0.0.0.0
So, the user changes directories when they install it. You aren't hard coding any paths. If you App.Path, then your program should find it, unless, after installtion, the user physically moves the file and that is something over which you have no control.
How to code the link for path location for the directory choose by the user during installation? I want all the files are deploy in the directory choose by the user during installaton. I found that, After I choose the directory, the files Precision Farming.mxd is deploy in this location C:\PF\Modeling, rather then C:\Project.. I run the exe from this directory C:\Project.. . This is C:\Project I create during installation.I want Precision Farming.mxd deploy in my choosen directory so that I can used App.path
How to code the link for path location for the directory choose by the user during installation? I want all the files are deploy in the directory choose by the user during installaton. I found that, After I choose the directory, the files Precision Farming.mxd is deploy in this location C:\PF\Modeling, rather then C:\Project.. I run the exe from this directory C:\Project.. . This is C:\Project I create during installation.I want Precision Farming.mxd deploy in my choosen directory so that I can used App.path
The whole idea behind App.Path is to not have the problem you think you have.
When you reference to a file your program is using, never hard code the path, but use App.Path in stead.
For example, your user changes the path during installation to something entirely different you think it would be. However the directory structure of your program remains the same. So if you have stored your database in a sub folder of where ever your app ended up, App.Path will lead you to it without any problem.
Lets say Modeling is the sub dir and Precision Farming.mxd is the database, you could find it easily like this:
vb Code:
App.Path & "\Modeling\Precision Farming.mxd"
The only problem you could encounter is when the user desides to install in the root dir, which never should be done of course. You can catch that error before it occurs by testing the App.Path string before you use it: