//调用 RemoveControls(this);public void RemoveControls(Control where) { foreach (Control c in where.Controls) { if (lbl is Label) { where.Controls.Remove(lbl);
} if (lbl is TextBox) { where.Controls.Remove(lbl); } if (c.Controls.Count > 0) { RemoveControls(c) } } }
RemoveControls(this);public void RemoveControls(Control where)
{
foreach (Control c in where.Controls)
{
if (lbl is Label)
{
where.Controls.Remove(lbl);
} if (lbl is TextBox)
{
where.Controls.Remove(lbl); }
if (c.Controls.Count > 0)
{
RemoveControls(c)
}
}
}
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
foreach (Control lbl in pxsInfo.Controls)
{
MessageBox.Show(lbl.Text);
pxsInfo.Controls.Remove(lbl);
//if (lbl is Label)
//{
// pxsInfo.Controls.Remove(lbl);
//} //if (lbl is TextBox)
//{
// pxsInfo.Controls.Remove(lbl); //} }
这样都不行,,,,