During development, I have told my program where to find its data by specifying the full path (C:\...) to where the data file is located on my computer. But when the program is exported to other computers, the data file will be located in the same folder with the .exe file of the program, and I need a generic expression for the path which will work on other computers, without my knowing what name users will give to the folder where they locate the program and data file. I have tried saying simply "Open [filename.extension] for Input As 1", assuming it will be understood that without the Drive and Directory specifications the default will be the directory where the program is located. But this approach gets me the message "Error 76: Path Not Found". This is hard to debug, because it happens only on someone else's compter, running the .exe file. Is there a way to designate a data file in the same folder generically? Or do I have to tell users what path and directory name they have to put the program and data in? I have not found an answer in the 642 pages of Programmer’s Guide VB 5.0.
You need to be careful where the app is deployed to if you are using App.Path to store files, if your app is going to be deployed under Program Files then a normal user will not have write permissions.
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein
When a program is using a relative path to a file it is relative to the current directory. That is only the same as App.Path when you get lucky: they can easily be entirely different things.
I agree, App.Path is not the proper place to put any data files unless they are read-only. You can get away with that for throwaway programs dumped into any random full access part of the filesystem, but it fails for properly installed programs.
If you leave your programs as "legacy" then appcompat usually bypasses the security violation by applying filesystem virtualization. But you don't really want either of those things to occur. The cleanest thing is to use a "Vista aware" manifest and put data files in the proper folders.
Ultimately that's more of a deployment question than a programming question, but the code needs to look in the right place too.