if(contorl is button)
{
   //
}
else
{
   //取出text
}

解决方案 »

  1.   

    Sample code:
    foreach( Control ctrl in yourPanel.Controls )
    {
       if( ctrl is Button )
       {
            continue;
       }
       else
       {
          //Get text here
       }
    }
      

  2.   

      我 现在 有这个方法?不知道 把过滤 添加到哪 块。
            public void tijiao()
            {
                System.Text.StringBuilder sb = new StringBuilder();
                foreach (Control c in this.Controls)
                {
                    if (c is Panel)
                    {
                        //foreach (Control c1 in c.Controls)
                        foreach (Control c1 in KK_Six.Controls)
                        {
                            sb.AppendLine(c1.Text);
                        }
                    }
                }
                MessageBox.Show(sb.ToString());
            }
      

  3.   

    public void tijiao() 
            { 
                System.Text.StringBuilder sb = new StringBuilder(); 
                foreach (Control c in this.Controls) 
                { 
                    if (c is Panel) 
                    { 
                        //foreach (Control c1 in c.Controls) 
                        foreach (Control c1 in KK_Six.Controls) 
                        { 
                           if (!(c is Button)) 
                           {
                           sb.AppendLine(c1.Text); 
                           }
                        } 
                    } 
                } 
                MessageBox.Show(sb.ToString()); 
            }
      

  4.   

    if(contorl is button) 

      // 

    else 

      //取出text 
      

  5.   

    不对啊!  还是 有  Button 的text 啊!