6
Answers

C# Application Setting

Ask a question
Sam

Sam

11y
2.6k
1
Hi, 

I use the user settings nice and easy. Works perfect for all types objects.
As far as I understand, when the Application Scope is User, settings saved separately for each user, by computer and user name. 


The problem is when I try to save the settings as Application scope, namely to be available to all users, regardless of user or computer.
While the Setting Interface accepts the setting with Application scope,when assigning a value to the setting, the program returns read-only error at design time.
I have looked into tens of web sites and information, all telling me to save as User, but I need it as common application setting, not per user.


Example: I define a 'versiondate' setting as type DateTime, Scope: Application, no value at this time.  


I then set:
Properties.Settings.Default.versiondate = DateTime.Now;  (Or any other legal DateTime object)
which will give me:
Error1Property or indexer 'Properties.Settings.fareDataSetApp' cannot be assigned to -- it is read only.....



To make a long story short: How can I preserve the Application settings (NOT User scope) using the standard setting form?


And, one more thing: Going through all documentation I found, I did not find any explanation on how to use the Value field in the setting form. (I expected to find there a list of all project's objects, by class or method, but I do not!)


Thanks.







Answers (6)