Hi,
In my app I have a group of checkboxes which represent different settings. I want to be able to load and save these settings into the program, and that works just fine. However I'm having trouble updating the checkboxes to show the settings. If I load the settings, only the first checkbox is updated. However I have a defaultsettings button, and when I click it the checkboxes are updated one at a time (I need to click the button 7 times to get the checkboxes to update).
Here is my code:
//Default settings constructor inside Settings class
public Settings()
{
acon = true;
addnew = true;
defNPC = "";
shoscr = true;
copscr = false;
savscr = false;
defpath = "C:\\Program Files\\Gothic\\_Work\\Scripts";
}
//my update code
private void button11_Click(object sender, EventArgs e)
{
AppSet = new Settings();
log.wtl("Domyślne ustawienia załadowane");
SetUI();
}
private void SetUI()
{
checkBox1.Checked = AppSet.acon;
checkBox2.Checked = AppSet.addnew;
textBox1.Text = AppSet.defNPC;
checkBox3.Checked = AppSet.shoscr;
checkBox4.Checked = AppSet.copscr;
checkBox5.Checked = AppSet.savscr;
textBox2.Text = AppSet.defpath;
log.wtl("Interfejs zaktualizowany");
}
Can anyone help me with this? Do I have to redraw the form or something? BTW AppSet is the global settings object.