foreach(Control ctr in form1.Controls)
{
if(ctr.Controls.count>0)
{
//递归
}
}

解决方案 »

  1.   

    private void GetControl(Control c){ MessageBox.Show(c.Name); foreach (Control ch in c.Controls) GetControl(ch);}调用:
    GetControl(this);
      

  2.   

    这里是递归:
    private void getCtr(Control ctr)
    {
    foreach(Control newctr in ctr.Controls)
    {
       if(newctr.Controls.count>0)
       {
           getCtr(newctr);
       }
    }}
      

  3.   

    this.Controls的到ControlCollection 集合
    然后用
    foreach(Control control in this.Controls)
    {
      if(control is TextBox)
       ......
    }
      

  4.   


     如下:
     
     private void button1_Click(object sender, System.EventArgs e)
    {
    System.Windows.Forms.Control.ControlCollection cc =this.Controls;  foreach(Control con in cc) 
    {
    listBox1.Items.Add(con.Name);
    }
    } :)