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?
Gary2397Asked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
1) Application.StartupPath is a run-time property, and not a deployment property.

2) It gets set when you execute the application.

3) Change the code like this:
   grdInventory.LoadLayout(IO.Path.Combine(Application.StartupPath, "grdInventory.txt")

Bob
0
 
Bob LearnedCommented:
Put it where the EXE is run from--Application.StartupPath

Bob
0
 
Gary2397Author Commented:
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.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Gary2397Author Commented:
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?
0
 
Bob LearnedCommented:
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
0
 
Gary2397Author Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.