Saving to virtual store in Windows 7
Testing out a VB.net prog in Windows 7 that works ok in Vista and earlier. The users can set various options and save them for next time. In pre Vista this goes in the program directory in program files, in Vista it is transparently put into the user's virtual store.
However, in Windows 7 trying to save the file gives an access denied error although the virtual store exists as for Vista and other apps appear to be using it ok. This is a program for schools and having to run the program as admin, if that would help anyway, is not an option. Anyone else had a problem with this?
Thanks for any suggestions.
Re: Saving to virtual store in Windows 7
The answer is to not save your file to the program folder. Windows has had an application data folder for a long time, before Vista started actually preventing you from saving to the program folder. You can use Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories to get numerous standard folder paths, including the application data folder.
Re: Saving to virtual store in Windows 7
Using specialdirectories to present My Documents as default path looks good. Thanks very much for your help.
Re: Saving to virtual store in Windows 7
For anyone else with same problem the best option is probably:
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
see:
http://msdn.microsoft.com/en-us/libr...db(VS.80).aspx
You set the path in project application/assembly information. You may still need to handle exception and set another path if does not exist for older versions of windows.