Results 1 to 7 of 7

Thread: Set Application Path [Resolved]

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Set Application Path [Resolved]

    In VB 6.0, we used to set the Application Path = App.Path.
    How can we do this in VB .NET? (without changing the startup project path). So that we will not have to change the full path.
    Please help. 10q!
    Last edited by albertlse; Aug 21st, 2003 at 08:36 PM.

  2. #2
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    If it's the current working directory you want to set check out the help on the 'Directory' class.

    It has a shared member called SetCurrentDirectory that might do the trick, that is if i understand what you are trying to do.

  3. #3
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    As luck would have it, I've just stumbled across this on another forum...

    "App.Path has been replaced with Application.StartupPath"

    Not sure what the forum rules are about posting links to other non-VBforums.com forum posts, but if you email me i will send it to you.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Application.StartupPath would move you to where your exe is executed (generally in bin folder) .

  5. #5

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Unhappy

    Thanks for replying my problem.

    I would like to make my problem clear once again. Hope it is clear this time.

    In VB 6.0, we use "App.Path" to set the path dynamically on run-time.

    How can I do so in VB .NET?

    FYI, my project path is "C:\Project".
    I do have an Image folder at "C:\Project\Image".

    By using "Application.StartupPath" always include the path we work on + \bin folder. "C:\Project\bin".

    By default, the \bin folder is where the application (*.exe) is being built.

    This cause some trouble as my program is going to retrieve image files from "C:\Project\Image".

    This means that if i use "Application.StartupPath", i need to move the Image folder to the \bin folder. "C:\Project\bin\Image".

    I knew that I can change the StartupPath to "C:\Project". This means that the application will be build here instead of "C:\Project\bin".

    Is there any alternative ways for me to solve this problem, so that I can still use the \bin folder to build my application
    and also do not need to move the Image folder to the \bin folder.

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    In reality this is only a problem while you're developing the application right? Once you release it for distribution, you are going to have to include that directory of images or your app creates them in its own directory...

    So in the meantime, simply copying the image directory into your solution folder works...

    Or am I missing something?

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Well , I can't see any problem here. When you build your exe and have it deployed , then you won't have a bin folder .Your startup path would be the folder where your exe is executed .

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