Reputation: 235
In the project properties in settings tab, I added the value *.*
.
Then I added another Setting1 and added to its value c:\
Then in form1 constructor:
textBox2.Text = (string)Properties.Settings.Default["Setting"];
textBox3.Text = (string)Properties.Settings.Default["Setting1"];
I want that each time the user type something in one of the textboxes, it will save it to settings.
private void textBox2_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default["Setting"] = textBox2.Text;
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default["Setting1"] = textBox3.Text;
}
But each time I'm running my program I'm getting the first settings *.*
and c:\
.
Upvotes: 1
Views: 75
Reputation: 7973
This is because you are not saving the changes that you are doing to your Properties.Settings
properties. To save the changes you must do this:
Properties.Settings.Default.Save();
Upvotes: 4