I have a program written in C# with a clear button, which needs to clear the content of the entire form. For the button I used on foreach for the radiobuttons and one for the checkboxes.
foreach (RadioButton rad in quiztabs.TabPages)
{
rad.Checked = false;
}
foreach (CheckBox chk in quiztabs.TabPages)
{
chk.Checked = false;
}
However, when I click the clear button I get an Unable to cast object of type System.Windows.Forms.TabPage to type System.Windows.Forms.RadioButton
.