-
Does anyone know how to use AppPath properly?
I have created a setup file for my application and it will only work if users install it in a certain directory. I have been trying to use the $(AppPath) in the code and it simply won't work
E.G. I have a directory testfiles as a subdirectory of the installation directory.
At the moment in the code, I access files in that directory directly by c:\MyApplication\testfiles\whatever.file
but I would like a way to be able to access it as
(installation directory)\testfiles\whatever.file
I know this can be done using $(AppPath) but have not found the correct way of doing this.
Any of you out there got examples of how this can be done?
Thanks.
-
I usually use the following code:
Code:
Dim FileName as String
FileName = App.Path
If Right$(FileName, 1) <> "\" Then FileName = FileName & "\"
FileName = FileName & "testfiles\whatever.file"
------------------
-
If you don't know what the path to the file is going to be before hand, then that won't work, thanks anyway.
-
Did you test it??
App.Path returns the path where the program is installed...
And if everything else fails, modify setup1.exe (source comes with VB), and save the path where the program is installed in the registry (useless though since app.path does the trick...)
-
No I didn't.
I just didn't read it properly, not with it today, sorry about that. Thanks again.