Sample code: foreach( Control ctrl in yourPanel.Controls ) { if( ctrl is Button ) { continue; } else { //Get text here } }
我 现在 有这个方法?不知道 把过滤 添加到哪 块。 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()); }
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()); }
foreach( Control ctrl in yourPanel.Controls )
{
if( ctrl is Button )
{
continue;
}
else
{
//Get text here
}
}
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());
}
{
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());
}
{
//
}
else
{
//取出text
}