I am having some trouble with my code that is supposed to redo the changes made by the user in the settings. When I click no after closing the form, the ribbonBar2 goes away, but when I open the settings up, the checkbox is still checked, although it isn’t supposed to be. Why?
Form1 frm1;
public Form8(Form1 frm1): this()
{
this.frm1 = frm1;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
frm1.ribbonBar2.Visible = checkBox1.Checked;
}
private void form8_closing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.checkBox1 = checkBox1.Checked;
DialogResult result1 = MessageBox.Show("Do you want to Save your Settings?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result1 == DialogResult.Yes)
{
Properties.Settings.Default.Save();
}
if (result1 == DialogResult.No)
{
checkBox1.Checked = !Properties.Settings.Default.checkBox1;
}
e.Cancel = false;
}
As it looks like no one is willing to help you with this…
You don’t restore any setting that you saved. If I understand you right, you want to do something like this: