I'm trying to use properties.settings for the first time in a C# WPF project.
I have this code:
Settings.Default.comPort = "";
Settings.Default.baudRate = 9600;
Settings.Default.startUp = false;
Settings.Default.taskBar = true;
Settings.Default.desktopNotif = false;
Settings.Default.reset = false;
Settings.Default.Save();
But it didn't work and the settings wasn't saved. So I added this line
Console.WriteLine("test");
after that part, to check if it goes through the code, and it executed fine.
So It seems that it just jumps over those lines without execution or even throwing any exceptions.
Thanks to Panagiotis Kanavos I eventually found the problem. The code was correct, but when the program runs inside the visual studio, every time the settings are being overwritten. After building, I ran the .exe file
in the bin/release
folder and it worked just fine.