Hi,
Assuming that you have 2 buttons on
Form1, and their names are:
button1 and
button2, you need to create settings (1 link will be good for start) for each control state you want to save. Example:
1. Setting name:
Button1Enabled, Type:
Bool
2. Setting name:
Button2Enabled, Type:
Bool
Then you should handle your Form1 events to store/restore buttons state.
1. When the form1 is closed save your settings to configuration file:
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
Properties.Settings.Default.Button1Enabled = button1.Enabled;
Properties.Settings.Default.Button2Enabled = button2.Enabled;
Properties.Settings.Default.Save();
}
2. Whe the form1 is loaded load your setting from configuration file:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
button1.Enabled = Properties.Settings.Default.Button1Enabled;
button2.Enabled = Properties.Settings.Default.Button2Enabled;
}
For further referrence you should take a look at this links:
Windows Forms User Settings in C#[
^]
http://msdn.microsoft.com/en-us/library/0zszyc6e%28v=vs.110%29.aspx[
^]
Hope it helps you :)