I have a panel with checkboxes and labels, I want to change all the checked states of the checkboxes when I click a button.
foreach (object x in panel1.Controls)
{
if (x.GetType() == typeof(CheckBox))
{
x.Checked = false; // problem is here;
// (CheckBox)x.Checked = false; // also didn't work
}
}
I’m certain it’s something simple but couldn’t find how to resolve the issue. I was able to write the same procedure in vb.net but don’t want to use that
Try
As you wrote it, the compiler understand