Link to home
Start Free TrialLog in
Avatar of Gary2397
Gary2397

asked on

File Location on Deployment

I have a VB.net Windows application - Using VS 2003

I have a grid that loads it's layout from a text file. Currently in the code I have the location of the file coded to my local machine. But I want to deploy the application and need to know how I should go about implementing my code so the file can be found in its location after the project is deployed and executed. Should I store the file in the Bin folder? Here is my current code:

grdInventory.LoadLayout("C:\Desktop\Layout\grdInventory.txt")

Any help?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Put it where the EXE is run from--Application.StartupPath

Bob
Avatar of Gary2397
Gary2397

ASKER

I have little experience with packaging a deploying. Will the application.startupPath be defined when creating the deployment package. Obviously, I need to modify the code before I package, how will I know what to put in the code? Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The code does work when I put the files in the bin folder. Now, will these files be created automatically in the bin folder when I package the application?
On the development machine, the application is built in the \bin folder, but on the production machine it won't be the \bin folder, but the target folder that you specified.

Bob
Wow, I am so sorry for not completely understanding this. If I keep all of the text files in a folder named "Layout", will I have to include the folder in the Install package. Would the code look like this:

grdInventory.LoadLayout(IO.Path.Combine(Application.StartupPath, "Layout\grdInventory.txt"))


How would the I get this "Layout" folder onto the machine the app was installed on? Thanks for being patient and explaining.