I would like to change one of my system timer values in my code (I am allowing the user to change the polling rate, which is determined by this timer value). I would like to store this value in app.config so that each time the application starts the new value is applied to the timer. However, I am having trouble understanding how to access, modify, and save a new value in app.config.
Here is my app.config file:
<
xml version="1.0" ><
configuration><
appSettings><!--
User application and configured property settings go here.--><!--
Example: <add key="settingName" value="settingValue"/> --><
add key="timer1.Enabled" value="True"/><
add key="timer1.Interval" value="500"/></
appSettings><
startup></
startup></configuration>I would like to allow the user to vary the timer1.Interval value in my code, and then save this new value in app.config. Can anyone give me some suggestions on the correct way to do this So far I have written the following:
NameValueCollection appSettings =ConfigurationManager.AppSettings;..but I am not sure how to modify the value of timer1.Interval. Any suggestions would be appreciated.