Hello dear users of Stackoverflow.
I have a project made in Winforms where i have a problem with an usercontrol I have created. The usercontrol consists of some layoutpanels, controls etc. It’s intended to be used as a settings controller. It has some properties used to change the design/layout of the usercontrol, such as a “ShowTitle” property og “ShowDefault” property, which is default set to ‘true’. The properties get/set references directly to the underlying control.visibility.
The usercontrols is placed in to a tabs control to give a overview of the settings, but (allmost) everytime I rebuild the solution the usercontrols in tab pages not currently shown in the designer have all their “Show…” properties changed to ‘false’.
If I remove the setting in the designer:
this.SpawnRate.ShowDefaultButton = false;
if pops up again when i rebuild.
I really don’t know whats goes wrong, and I have bug hunted the code for hours. Does anyone have a clue where the problem might lie?
//Nautious
EDIT: it is only properties referencing to control.visibility properties who changes their value
UPDATE:
Found the problem… Apprently I can’t return the Control.Visible value directly like this:
bool ShowBtn
{
get{ return Btn_Default.Visible; }
set{ Btn_Default.Visible = value; }
}
but had to have a local variable:
bool ShowBtn
{
get{ return _ShowDefault; }
set{ Btn_Default.Visible = value;
_ShowDefault = value; }
}
bool _ShowDefault = true;
after changing, the problem no longer occurred.
anyone know why the problem is there?
Found the problem… Apprently I can’t return the Control.Visible value directly like this:
but had to have a local variable:
after changing, the problem no longer occurred.