I have the following problem: I have a base form with a panel docked to the bottom and inside the panel some buttons. The forms inheriting this base form can modify the visibility of the base form buttons by properties like “ButtonCloseVisiblity” that appears in the child form properties. The problem is that sometimes when the child form refreshes (for example, when I double click an event, delete the newly created event in code and go back to the designer), the visibility of the buttons are set again to their default state.
Share
Digging for an answer I come to this, when I have a base form and use properties that get/set a property from a control directly like:
When modifying in the child forms, this modification is not persisted to code, and the visibility is defined by the base form, hence every time a child form is opened or the project is rebuilt the visibility of the inherited controls defaults to the base form value. In order to solve this issue we must add a field and change its value in the property:
In this way the property is persisted in code.