日期:2014-05-18 浏览次数:20974 次
            for (int i = 1; i < 101; i++)
            {
                Control c = this.Controls["t"+i.ToString()];
                if (c != null)
                {
                    MessageBox.Show(c.Text);
                }
            }
------解决方案--------------------
for (int i = 1; i <= 100; i++)
{
    Control ctrl = this.Controls.Find("t" + i, false)[0];
    // 类型转换成某控件,或直接提取共有属性,比如 ctrl.Text
}
------解决方案--------------------
foreach (Control item in this.Controls)
           {
               item.Text;                
           }
------解决方案--------------------
foreach (System.Windows.Forms.Control control in this.groupBox2.Controls)//遍历groupBox2上的所有控件 
  { 
   if (control is System.Windows.Forms.TextBox) 
   { 
    System.Windows.Forms.TextBox tb= (System.Windows.Forms.TextBox)control; 
    //想做的事.....  
   }  
  //其他类型的控件
  }