Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
hi experts

I'm using the code for saving my settings (in Class Library) not any exceptions but my Settings never change.
What can I do for solve the problem?
C#
Properties.Settings.Default.ProgramTitle = head;
Properties.Settings.Default.PageTitle= title;
Properties.Settings.Default.MaxItemsForShowing = maxItems;
Properties.Settings.Default.MinItemsForShowing = minItems;

Properties.Settings.Default.Save();


Their scope are "User"
Posted
Updated 8-Aug-12 0:27am
v2

If these are user settings then they are not writing in your application config file but elsewhere. If you were to restart the application and fetch the values again you should see the new values. Check that these setting are indeed user settings because application settings cannot be changed at runtime.
 
Share this answer
 
v2
Comments
Vartan Khachatourian 8-Aug-12 6:06am    
thanks but they are user not application. what can I do for solving it?
Philip Stuyck 8-Aug-12 6:14am    
How do you know that they are not saved ?
Vartan Khachatourian 8-Aug-12 6:27am    
Because when I'm checking them they seem not changed and when I restart the application, it loads the previouse values.
Philip Stuyck 8-Aug-12 7:19am    
You have your setting in a class library, it should be part of your application.
If your settings are supposed to be changed from within your library then create an interface on top of the settings where all properties that are needed in the library are specified, then create a partial class for the settings class and add the interface. From then on you can pass the interface towards the library and start using the interface. The interface should be part of the library too.
Vartan Khachatourian 8-Aug-12 7:25am    
The code that changes the values and saves (in my question) is in the class library. It's already trying to change the setting from the class library.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900