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!
Printable View
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!
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.
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.
Application.StartupPath would move you to where your exe is executed (generally in bin folder) .
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.
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?
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 .