【发布时间】:2013-12-07 12:09:40
【问题描述】:
有人知道如何将字符串附加到变量名吗?
public void editForm(DataGridView dg)
{
for(int i=0; i<=dg.Columns.Count-1;i++)
{
TextBox txt=new TextBox(); //I want to append i to txt. like -->TextBox txt&i
}
}
然后我将创建的文本框添加到表单中。
【问题讨论】:
-
为什么不是文本框的数组或列表?即 List
列表;然后 list.Add(new TextBox());
标签: c#