|
-
Dec 5th, 2003, 02:55 PM
#1
Thread Starter
Lively Member
Changing install destination in startup.
My application relies on multiple data files to properly parse another file. The path that I use to access the datafiles, as well as a list of the data files is in an xml file.
I used VB.Net to package my solution, and it spits out a generic setup.exe. In that exe, it asks where you want to install the program to. As long as the user chooses the default, everything runs fine. However, if they want it in a different directory or drive, my program cannot find the data files.
Is there someway of changing the path in the xml file to reflect the changed installation destination?
-
Dec 8th, 2003, 09:02 AM
#2
Thread Starter
Lively Member
[bump]
I really need help on this.
-
Dec 8th, 2003, 09:05 AM
#3
Using the line:
System.Reflection.Assembly.GetExecutingAssembly.Location()
It returns the location of where your running the .exe file from. You can use this instead of a hard-coded path to your resource files.
-
Dec 8th, 2003, 09:12 AM
#4
Member
If the data files are always in a path relative to the location from where the application is started you can use Application.StartupPath as in:
Code:
Dim xr As New XmlTextReader(Application.StartupPath & "\data\testcase.xml")
-
Dec 8th, 2003, 02:08 PM
#5
Thread Starter
Lively Member
Thanks alot. I used :
VB Code:
Dim datpath As String = Application.StartupPath & "\data\"
and it worked great. I think I need a better book, because that was too easy.
Thanks.
-
Dec 8th, 2003, 02:14 PM
#6
Member
It's not so much a better book.. I doubt there are books that cover everything and as with so many thing people tend to overlook the most basic stuff that they take for granted by now..
I learn a lot from browsing here and other forums like VBcity and reading code.. Once you get the basic feel of how VB.NET works you can pick up a lot from just reading code fragments (so I found out)..
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
|