Reputation: 25
I want to save settings between two sessions.
I change the value, save it, close the program and its still the old one... WHY?
int test = Properties.Settings.Default.mode;
System.Console.WriteLine(test);
Properties.Settings.Default.mode = 1;
Properties.Settings.Default.Save();
test = Properties.Settings.Default.mode;
System.Console.WriteLine(test);
XML:
<userSettings>
<PyControl.Properties.Settings>
<setting name="mode" serializeAs="String">
<value>0</value>
</setting>
</PyControl.Properties.Settings>
</userSettings>
Upvotes: 0
Views: 211
Reputation: 835
Probably you were finding the settings file in wrong place? It isn't in your bin folder.
Your application will have a settings folder under %userprofile%\appdata\local or %userprofile%\Local Settings\Application Data depending on which version of Windows you're running, for settings that are user specific. If you store settings for all users, then they'll be in the corresponding folder under C:\users or C:\Documents and Settings for all user profiles (ex: C:\users\public\appdata\local).
Ref: Where are the Properties.Settings.Default stored?
Edit:
Assume if you're NOT using Windows IoT, try ~/.config/{AppName}/user.config
? I don't write C# on RPi but above link mentioned this folder. -- If not here, I'm sorry that I can't offer further help :(
Upvotes: 0