1

So I am trying to modify a Settings Variable I created in my second Form, but it doesn't seem to work. There is no exception thrown or anything, it just straight up doesn't do, as it (in my humble opinion) should. Here is some Code:

namespace Tank
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            this.Text = Properties.Settings.Default.Tankhöhe.ToString();

        }

        private void btnLoadHeight_Click(object sender, EventArgs e)
        {

                Properties.Settings.Default.Tankhöhe = Convert.ToDouble(mtbTankhöhe.Text);


        }

I am really confused by how I can Read and write on this variable without any error message but only writing doesn't seem to work.

Haaani
  • 15
  • 4

1 Answers1

1

You should save the changes after setting them:

Properties.Settings.Default.Tankhöhe = Convert.ToDouble(mtbTankhöhe.Text);
Properties.Settings.Default.Save();
Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171
  • I tried that, it throws me an Error with the Code CS0262 saying something like: **Partial declaration of "Settings" has Accessmodifiers who don't work together.** I didn't change anything in this class tho. – Haaani Dec 07 '19 at 13:05