foreach (Control item in groupBox1.Controls)

                    {

                        if (item is TextBox) //判断控件是不是TextBox

                        {

                            item.Text = ""; //如果text就为空

                        }

                        else if (item is ComboBox) //判断控件是不是Combox

                        {

                            ((ComboBox)item).SelectedIndex = -1;

//Item强制转换(Combox

                        }

                      

                    }

 

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-15
  • 2021-06-24
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案