foreach(Control c in tabControl1.TabPages)这个循环的意思是说,遍历tabControl1中所有的TabPages,TabPages是包含在tabControl1里面的,循环进来之后,每次循环,c的类型是TabPage,而不是TabControl。代码修改为:

foreach (Control c in tabControl1.TabPages)
{
if (c is TabPage)
{
foreach (Control b in c.Controls)
{
if (b is CheckBox) ((CheckBox)b).Checked = false;
}
}
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-02
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-07-27
相关资源
相似解决方案