第1个回答 2013-05-21
//给你演示如何获取全部控件,包括容器里面的
private List<Control> AllControls = new List<Control>();
private void FindControls(Control container)
{
foreach (Control c in container.Controls)
{
AllControls.Add(c);
if (c.HasChildren)
{
FindControls(c);
}
}
}
private void button1_Click(object sender, EventArgs e)
{
FindControls(this);
foreach (Control c in AllControls)
{
MessageBox.Show(c.Name.ToString());
}
}本回答被提问者采纳
第2个回答 2013-05-21
这个 可以有
用findcontorl方法
具体你查下所用容易的findcontrols如何使用
第3个回答 2013-05-21
在其他容器里面的控件需要用到一个FindControl(id)方法获取里面的控件
第4个回答 2013-05-21
用多重循环试试行不,我现在手上没电脑只有手机,明天我试试看行不行再联系你