Alan Cai's Blogs
只埋头苦干是不行的,有时候还得抬头看看外面的世界。

WinForm

foreach (Control control in this.Controls) {
    if (control is TextBox) {
        (control as TextBox).Text = "Hello World.";
    }
}

ASP.NET

foreach (Control control in this.FindControl("form1").Controls) {
    if (control is TextBox) {
        (control as TextBox).Text = "Hello world.";
    }
}
posted on 2008-09-11 10:24  Alan Cai  阅读(489)  评论(0编辑  收藏  举报