没看见图啊
我也想知道
等待ing

解决方案 »

  1.   

    foreach(TextBox t in this.Controls)
    {
    MessageBox.Show(t.Text);
    }
      

  2.   

    for(int i=0;this.Controls.Count-1;i++)
      if(this.Controls[i] is TextBox)
        this.Controls[i].Text="";
      

  3.   

    /// <summary>
    /// 设置此界面中控件的某些属性
    /// </summary>
    /// <param name="ctl"></param>
    public void Set_Controls(Control ctl)
    {
    //当控件没有子控件时
    if ( !ctl.HasChildren)
    {
    switch(ctl.GetType().ToString())
    {
    case "System.Windows.Forms.Label":
    break;
    case "System.Windows.Forms.Button":
    break;
    case "System.Windows.Forms.TextBox":
    break;
    case "System.Windows.Forms.ListView":
    break;
    case "System.Windows.Forms.GroupBox":
    break;
    case "System.Windows.Forms.ComboBox":
    break;
    case "System.Windows.Forms.ImageList":
    break;
    case "System.Windows.Forms.DataGrid":
    break;
    case "System.Windows.Forms.MainMenu":
    break;
    case "System.Windows.Forms.TreeView":
    break;
    }
    }
    else //当控件有子控件时
    {
    int i = 0;
    while ( i < ctl.Controls.Count )
    {
    Set_Controls( ctl.Controls[i] );
    i ++;
    }
    }
    }你调用时,可以这样用:
    Set_Controls(this);
      

  4.   

    具体的你要设置控件的属性什么的
    你可以在case中设置
      

  5.   

    private void button1_Click(object sender, System.EventArgs e)
    {
    foreach(TextBox s in this.Controls )
    {
    MessageBox.Show (s.ToString());


    }
    }
      

  6.   

    foreach(Control c in Controls)
    {
      if(c is TextBox)
        MessageBox.Show("good");
    }
      

  7.   

    楼上的代码有问题 如果TextBox是在容器控件中是无法历遍到的
    不过可以再加个递归。还有一个方法是利用Reflection 查找所有field