For some reason, when setting variables through Properties.Settings.Default , all other variables in Settings are reset to 0 (All parameters of type int ). Set values ​​like code.

  Properties.Settings.Default.Slow_pc = X; Properties.Settings.Default.Save(); 

That is, the button has to write certain variables for subsequent writing to the file, but if the parameters are not used by the button, then they reset the value. Perhaps the mistake is stupid.

UPD

For example, there are variables

  Properties.Settings.Default.var1 = 1 Properties.Settings.Default.var2 = 2 Properties.Settings.Default.var3 = 3 

And there is a button that sets the variable var1 code and write all the variables in the file

  private void button1(object sender, RoutedEventArgs e) { Properties.Settings.Default.var1 = 4; Properties.Settings.Default.Save(); string FileText = Properties.Settings.Default.var1 + "/" + Properties.Settings.Default.var2 +"/"+ Properties.Settings.Default.var3; File.WriteAllText(C:/.../File.txt, FileText); } 

As a result, a text file will be displayed.

  4/0/0 

but not

  4/2/3 

as was expected.

  • Specify where you save the settings - what is set in the Scope settings for these parameters - User or Application. If User and you start one time from debug, and another time from a folder, it can be, because for the system these are two different programs. - koshe
  • @koshe maybe I didn’t explain. Parameters are reset within one session. - Homid Way
  • This should not be, can give the full code relating to the setting of the settings and how you check them. - koshe
  • @koshe I understand that this should not be, so I asked for help. I added a post. - Homid Way
  • You write that for example there are variables ... , 1,2 and 3, these values ​​are set in Settings or assigned from the code? If from the code, then at the end there should be the string Properties.Settings.Default.Save(); Settings. Properties.Settings.Default.Save(); otherwise they will not be written to the file. Give the full code (if a lot of code, create a new project and transfer all related parameters). - koshe

0