Hello,
I'm working on an application which has a property settings form accessible and shown when clicked on the menu-item of the mainform.
The settingsform is declared (frmsettings = new frmsettings()) at the top of the mainform.
If the frmsettings is closed I only hide it, thus preserving the settings when the .show is called again.
Now I'd like to add a cancel button to the form.
If this would be clicked, the form should turn back to the state it was before calling the show method, thus neglecting all recent changes just made.
If the OK button is clicked, the form should accept the changes.
This is the current method I tried to get to this:
The problem is now that the frmCurrentSetti ngs does not get updated.
Each time I change someting on the settings form and I press OK, and I reload the settings form, it's back at default.
Is there anyone who would know how to handle this problem?
Thanks a lot.
I'm working on an application which has a property settings form accessible and shown when clicked on the menu-item of the mainform.
The settingsform is declared (frmsettings = new frmsettings()) at the top of the mainform.
If the frmsettings is closed I only hide it, thus preserving the settings when the .show is called again.
Now I'd like to add a cancel button to the form.
If this would be clicked, the form should turn back to the state it was before calling the show method, thus neglecting all recent changes just made.
If the OK button is clicked, the form should accept the changes.
This is the current method I tried to get to this:
Code:
//within frmsettings:
Static frmCurrentSettings = new frmSettings();
mnuShow_Click()
{
frmSettings frmTemp = new frmSettings();
frmTemp = frmCurrentSettings;
frmTemp.Show();
}
//And within the frmsettings:
btnOK_Click()
{
frmMain.frmCurrentSettings = this;
}
btnCancel_Click()
{
//nothing, just close
}
Each time I change someting on the settings form and I press OK, and I reload the settings form, it's back at default.
Is there anyone who would know how to handle this problem?
Thanks a lot.
Comment