Solved

save properties setting at runtime

Posted on 2009-07-09
1
511 Views
Last Modified: 2012-05-07
Having trouble saving setting value. I created a Settings.settings file in my C# project and would like to save a variable to that file. I looked at the example at MSDN:

To Write and Persist User Settings at Run Time
Access the user setting and assign it a new value, as shown in the following example:
Properties.Settings.Default.myColor = Color.AliceBlue;

My code:
Properties.Settings.Default.apiCallsCalled = 1000;

I get an error saying '=' is an invalid token in class, struct, interface or member declaration. Can someone tell me what's wrong?

Thanks,
0
Comment
Question by:acclimate
1 Comment
 
LVL 10

Accepted Solution

by:
stormist earned 250 total points
ID: 24819482
Set it within your form load or init section. Also, do not forget to call the Save() method, your settings will not automatically persist.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
fomat Json objects 6 28
Sum Column in GridView 3 44
Class object 2 26
Error on Add method 1 38
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now