请教一个WinFrom的问题 新手
就是我声明一个数组:
string[] j = { "txtAviationNo", "txtAirways", "txtLeave", "txtLand", "txtLeaveTime", "txtLandTime", "txtFare" };
存放的是窗口的控件名
然后再后面用for循环引用赋值可以吗?
就是像这样:
for(int i=0;i<7;i++)
{
j[i].text="添加信息";
}
但这样又是错的
请教一下各位大大有声明办法没
------解决方案--------------------遍历Controls找到textBox控件赋值
------解决方案-------------------- string[] j = { "txtAviationNo", "txtAirways", "txtLeave", "txtLand", "txtLeaveTime", "txtLandTime", "txtFare" };
for (int i = 0; i < 7; i++)
{
this.Controls[j[i]].Text = "添加信息";
}