Hi,
Sorry. I test on my side. I am not able to reproduce. When I click Checkbox1, checkbox2 is also checked.
I think I may miss something.
The following is my test:
private void Form1_Load(object sender, EventArgs e)
{
// Copy your code
this.checkBox1.Checked = global::Test0930.Properties.Settings.Default.check1;
this.checkBox1.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::Test0930.Properties.Settings.Default, "check1", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.checkBox1.Name = "checkBox1";
this.checkBox1.Text = "checkBox1";
this.checkBox1.CheckedChanged += new EventHandler(checkBox1_CheckedChanged);
this.checkBox2.Checked = global::Test0930.Properties.Settings.Default.check2;
this.checkBox2.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::Test0930.Properties.Settings.Default, "check2", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.checkBox2.Name = "checkBox2";
this.checkBox2.Text = "checkBox2";
this.checkBox2.CheckedChanged += new EventHandler(checkBox2_CheckedChanged);
}
void checkBox1_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.check2 = checkBox1.Checked;
}
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine(Settings.Default.check2.ToString());
}
void checkBox2_CheckedChanged(object sender, EventArgs e)
{
}
Code in settings.Designer.cs:
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool check1 {
get {
return ((bool)(this["check1"]));
}
set {
this["check1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool check2 {
get {
return ((bool)(this["check2"]));
}
set {
this["check2"] = value;
}
}
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.