Results 1 to 6 of 6

Thread: Changing install destination in startup.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92

    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?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92
    [bump]

    I really need help on this.

  3. #3
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    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.

  4. #4
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53
    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")

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92
    Thanks alot. I used :

    VB Code:
    1. Dim datpath As String = Application.StartupPath & "\data\"

    and it worked great. I think I need a better book, because that was too easy.

    Thanks.

  6. #6
    Member
    Join Date
    Nov 2003
    Location
    Amsterdam, The Netherlands
    Posts
    53
    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
  •  



Click Here to Expand Forum to Full Width