winform中想把textbox作为变量 有35个textbox,想作为变量使用,即: ArrayList a = new ArrayList();
for(int x=0;x<=35;x++) {
a[x] = TextBox[x].text;
}
当然 上面的写法是错误的,求解决方法
------解决方案--------------------
C# code
List<string> list = new List<string>();
for (int i = 0, count = this.Controls.Count; i < count; i++)
{
if (this.Controls[i] is TextBox)
{
list.Add(this.Controls[i].Text.ToString());
}
}