TextBox遍历
时间:2010-08-24 来源:SoLo.
代码
foreach (Control control in this.form1.Controls)
{
if (control.GetType().Name == "TextBox")
{
((TextBox)control).Text = "KKK";
}
}
foreach (object control in this.form1.Controls)
{
if (control is TextBox)
{
TextBox tb = (TextBox)control;
tb.Text = "KKK";
}
}
{
if (control.GetType().Name == "TextBox")
{
((TextBox)control).Text = "KKK";
}
}
foreach (object control in this.form1.Controls)
{
if (control is TextBox)
{
TextBox tb = (TextBox)control;
tb.Text = "KKK";
}
}
相关阅读 更多 +