Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using Settings file.

Tags:

c#

settings

I'm trying to use a settings file in VS 2013 to store the text of textBox1.Text and then re-input it when you open the application again.

I have it setup like this.

Settings file is here: http://i.gyazo.com/e3aef293c3b8dbdfab269718de81a310.png

On public Form1() I have this to read the text.

    textBox1.Text = Properties.Settings.Default.aaa;

then on saving it I have it like this.

    if (checkBox1.Checked)
    {
        Properties.Settings.Default.aaa = textBox1.Text;
    }

But I get the error

 'WindowsFormsApplication1.Properties.Settings' does not contain a definition for 'aaa' and no extension method 'aaa' accepting a first argument of type 'WindowsFormsApplication1.Properties.Settings' could be found (are you missing a using directive or an assembly reference?)

Thanks for the help.

like image 985
user2231227 Avatar asked Nov 23 '22 18:11

user2231227


1 Answers

I had this problem. The issue was that Settings.settings was in both the Properties folder and the root folder. I replaced the one in the Properties folder with the other one. I think this issue can occur if you unload and reload a Project.

like image 197
BrettB Avatar answered Dec 22 '22 11:12

BrettB