Member 14778963 wrote:
I want to make it so when the user press a button, another button becomes invisible and if he closes the app and runs it again it will be the same.
You can take advantage of the application settings property binding:
- Have a boolean setting defined for the visibility of the button; name the setting "Button2Visible" for example.
- Select the button whose visibility to persist; in the properties panel, go to (ApplicationSettings)->(PropertyBinding) and click on the "..." button.
- Navigate to the "Visible" property and select the "Button2Visibility" setting.
- Click "OK".
Now, you can just use this simple code:
private void Button1_Click(object sender, EventArgs e)
{
Button2.Visible = false;
Settings.Default.Save();
}
The visibility of Button2 will be automatically persisted across subsequent sessions.