I want to storen and read a number of settings that the user can change. I followed as mentioned here via the properties of the project, but I saw that there is also a file called "Settings.settings". This file is empty. Is this file not needed? Can I delete it?
Another question I have is how to read the settings. For example I have a setting called "InitialSave" as a boolean. Using this gives the error "Operator '==' cannot be applied to operands of type 'object' and 'bool'". Can I read direct from the settings or should I declare each setting at startup?
Properties.Settings.Default["InitialSave"] == true
You right click this and choose "Open With.. Settings Designer":
Or you get properties of the project and click Settings on the left. Then you see this:
You put some settings and types in:
You write Properties.Settings.Default.
in code and then you see your settings:
You can read and write them, as properties of the types you specified
You can even bind them to controls:
Toggling that control tick state would alter the value of Proeprties.Settings.Default.IsMinimized
note: Only User Scoped settings can be changed/saved. App Scope settings are kept in the YourExeName.config file and are changed by editing the file with a text editor. User Scope settings are kept elsewhere (in your user folder) and can be modified and saved at runtime to keep that value for next time the program launches
OK, so you said that you can have Settings.settings open in two places; I can't make this occur with the following steps (uses .NET core because Wolle's answer claims core is different; I couldn't support that claim either):
settings.settings
file. see this: