Oh wow is this one annoying me. Using c#, winforms, visual studio 2010 ulti.
Here's my code:
private void CheckBoxBranch_CheckedChanged(object sender, EventArgs e)
{
if (CheckBoxBranch.Checked == true)
{
panelBranch.Visible = true;
//panelBranch.Parent = null;
//PanelBuyer.Parent = null;
//panelBranch.SendToBack();
//PanelBuyer.SendToBack();
PanelBuyer.Visible = false;
CheckBoxBuyer.Checked = false;
this.Refresh();
}
if (CheckBoxBranch.Checked == false)
{
panelBranch.Visible = false;
this.Refresh();
}
}
private void CheckBoxBuyer_CheckedChanged(object sender, EventArgs e)
{
if (CheckBoxBuyer.Checked == true)
{
panelBranch.Visible = false;
PanelBuyer.Visible = true;
CheckBoxBranch.Checked = false;
this.Refresh();
}
if (CheckBoxBuyer.Checked == false)
{
PanelBuyer.Visible = false;
this.Refresh();
}
}
now this code works fine, no problems, as long as the panels are not on top of each other. When this happens panel-Buyer works fine, Panel-Branch never shows at all.
Now I think this has something to do with the branch panel becoming a child of the buyer panel thus when my logic runs for buyer it applies itself to branch too.
I could transform there positions each time like a rotation but that's a lot of extra code.
Is there a way to solved this headache nice short sweet and simple one liner? (I wish).