c# with windows forms.
It seems that there's some event that's sticking in the behavior, and I don't understand which and how to disable it.
I have checkboxes that should show three labels and a panel in common with other checkboxes and show its own. Once you uncheck, it should verify if there's another checkbox checked and if it's true, should keep the labels and the panel visible and hide it own label, but the last unselected should hide the panel and the three labels with it own.
The code I have.
public void chBox()
{
foreach (CheckBox boxes in panel3.Controls)
{
if (boxes.Checked == true)
panel4.Visible = true;
else
panel4.Visible = false;
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
chBox();
label4.Visible = true;
}
else
{
label4.Visible = false;
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
chBox();
label6.Visible = true;
}
else
{
label6.Visible = false;
}
}
Thanks a lot if somebody can give a Hint.