Saving user preferences

Hello all,

I have an application which needs to store the user preferences and configuration settings somewhere on the disk so that it could load them when the application starts up. I am supposed to use SQL server authentication which means more than one person can launch the application from the same windows login account. This means that I cant use IsolatedStorage, isnt it I thought of creating xml files for each user but I dont know where to store them on the disk !! Any pointers on this would be appreciated.

Thanks a lot!


Answer this question

Saving user preferences

  • Mark A. Richman

    Hello,

    Have you thought of putting it in the registry under HKEY_LOCAL_USER This is what we use for our individual user settings for our applications. It is a lot cleaner than using the disk because you don't have to know who is logged in to figure out where your settings are.

    Ken


  • mae ann

    Thanks Rich,

    I didn't even know this existed. I like this much better.


  • johndoecal

    Or if you are in the .NET 2/VS2005 world, you could use visual studio's built-in support for application and user settings.

    For windows forms projects (not sure about other types) there is a Settings.settings file under the Properties folder in the solution view. Place your properties in there, and access them using

    Settings.Default.MyPropertyName

    and Save the (user) settings with Settings.Default.Save()

  • Learning VB

    Just a little more info in case you are not familiar with the Registry.

    You should put your app settings that are specific to a user under the key HKEY_CURRENT_USER but it should be in its own key under the Software key. Something like HKEY_CURRENT_USER\Software\{YourAppName}\Settings or something like that.

    If you have settings you want to store that would apply to anyone running the app, put the settings under HKEY_LOCAL_MACHINE\Software ....


  • Saving user preferences