Handle the CheckChanged event, and set the Visible property to false:
void myCheckBox_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = sender as CheckBox;
if (cb != null)
{
cb.Visible = false;
}
}
"Thanks your help.
when i select one Check Box, one is hide.
when i select another one, that one also hide again.
But i want only one hide.( i mean when i select check Box(1),Check Box(1) is hide; When i select Check Box(2),Check Box(2) is hide but Check Box(1) no hide."
Well if that is what you want, then explain that in your question! Do you think we can read your mind? :laugh:
So, instead of one event handler, you need two:
void leftCheckBox_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = sender as CheckBox;
if (cb != null)
{
leftCheckBox.Visible = !cb.Checked;
rightCheckBox.Visible = cb.Checked;
}
}
void rightCheckBox_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = sender as CheckBox;
if (cb != null)
{
rightCheckBox.Visible = !cb.Checked;
leftCheckBox.Visible = cb.Checked;
}
}
[edit]removed the spurious "_CheckChanged" bits... :O - OriginalGriff [/edit]