Peter Kiers
asked on
Question about Settings-editor
Hi,
I have main form called MainForm and a dialogform called frmSettings.
on the frmSettings form i have a checkbox called chkShowMin
I have entered the values of the chkShowMin in the settings-editor:
chkShowMin - bool - User - True
But when I execute my programm the checkbox isn't checked and i have
set it to true in the editor.
What do I do wrong?
P.
I have main form called MainForm and a dialogform called frmSettings.
on the frmSettings form i have a checkbox called chkShowMin
I have entered the values of the chkShowMin in the settings-editor:
chkShowMin - bool - User - True
But when I execute my programm the checkbox isn't checked and i have
set it to true in the editor.
What do I do wrong?
P.
ASKER
I have this:
private void Settings_Load(object sender, EventArgs e)
{
this.chkShowMin.Checked = Properties.Settings.Defaul t.ShowMin;
}
private void Settings_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Defaul t.ShowMin = this.chkShowMin.Checked;
}
But it isn't all is it. What do I have to do more...
Peter
private void Settings_Load(object sender, EventArgs e)
{
this.chkShowMin.Checked = Properties.Settings.Defaul
}
private void Settings_FormClosed(object
{
Properties.Settings.Defaul
}
But it isn't all is it. What do I have to do more...
Peter
ASKER
I have to put something here, i think:
private void btnOK_Click(object sender, EventArgs e)
{
{
xxx
}
this.Close();
}
private void btnOK_Click(object sender, EventArgs e)
{
{
xxx
}
this.Close();
}
When closing, after setting the value, you need to Save them:
Back in the main form, after the settings form closes, you'd need to update the ShowMinutes() property on your control. If you displayed settings from with ShowDialog() then you could place this line directly after that to make it update:
private void Settings_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.ShowMin = this.chkShowMin.Checked;
Properties.Settings.Default.Save();
}
Back in the main form, after the settings form closes, you'd need to update the ShowMinutes() property on your control. If you displayed settings from with ShowDialog() then you could place this line directly after that to make it update:
// In main form, after the "settings" ShowDialog() line:
schedulerControl.DayView.TimeRulers[0].ShowMinutes = Properties.Settings.Default.ShowMin;
ASKER
I have this, but i doesn't work:
private void Settings_Load(object sender, EventArgs e)
{
this.chkShowMin.Checked = Properties.Settings.Defaul t.ShowMin;
}
private void Settings_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Defaul t.ShowMin = this.chkShowMin.Checked;
}
When I check my checkbox and close the frmSettings and then the application.
And then start my app again and open the frmSettings the chkShowMin is not checked???
What do I do wrong?
P.
private void Settings_Load(object sender, EventArgs e)
{
this.chkShowMin.Checked = Properties.Settings.Defaul
}
private void Settings_FormClosed(object
{
Properties.Settings.Defaul
}
When I check my checkbox and close the frmSettings and then the application.
And then start my app again and open the frmSettings the chkShowMin is not checked???
What do I do wrong?
P.
See my last post...you need to call Save() to update the values. (line #4 in the first snippet)
ASKER
Oke, one little last Q.
When I click on the OK-button of the frmSettings-form.
and the chkshowmin was true then show the property
ShowMinutes (=true)
and if the chkshowmin was false then hidethe property
ShowMinutes (=false)
Could you help me with this before i give you the points.
P.
When I click on the OK-button of the frmSettings-form.
and the chkshowmin was true then show the property
ShowMinutes (=true)
and if the chkshowmin was false then hidethe property
ShowMinutes (=false)
Could you help me with this before i give you the points.
P.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I give you allready the points. Because I got to go.
Thank you for your help.
Peter
Thank you for your help.
Peter
Open in new window