c# 问题(求大家帮忙)

来源:百度知道 编辑:UC知道 时间:2024/09/20 11:45:26
c# 怎么便利

找到 里面得所有label 控件并把他们赋值 为321312

foreach (Control ctrl in this.Controls)
{
if (ctrl is System.Windows.Forms.Label)
{
ctrl.Text = "321312";
}
}

没看懂,很想帮你
请具体一点

foreach(Control a in page.Controls)
{
HtmlForm from =a as HtmlForm;
if(from ==null)
{
continue;
}
foreach(Control y in form.Controls)
{
Label lab=y as Label;
if(y==null)
{
continue;
}
lab.Text="321312";
}
}