1
Reply

Need help with App Settings (Application, vs. User, Persistence. etc)

Bill Az

Bill Az

Nov 21 2009 8:36 AM
4.9k
I added a Settings File to my vs2008 c# Project. I have defined a number of User level settings. 

A weird thing that I noticed is when I try to access the Settings inmy code, I get a compile error when using
sFavoriteColor = Properties.Settings.Default.MyFavoriteColorSetting;
Error    1    'myProject.Properties.Settings' does not contain a definition for 'Default'
 

If I remove the reference to Properties, I can compile and read the settings.
sFavoriteColor = Settings.Default.MyFavoriteColorSetting;
This does not seem to match documentation on how to access Properites/Settings.

Has anyone else ever seen this?
Is there something obvious that I am doing wrong?

I have confirmed that changes to my Settings are persisted back to the User's user.config file, but occassionally, my settings seem to get reset to the App Default values. Perhaps this is due to something else I am doing (rebuild, version change, etc).

I appreciate any knowledge on persisting user settings that can be bestowed.

thanks


Answers (1)