這是我的代碼。 但我所有的文本框的值都是空值。動態創建多個文本框C#
public void createTxtTeamNames()
{
TextBox[] txtTeamNames = new TextBox[teams];
int i = 0;
foreach (TextBox txt in txtTeamNames)
{
string name = "TeamNumber" + i.ToString();
txt.Name = name;
txt.Text = name;
txt.Location = new Point(172, 32 + (i * 28));
txt.Visible = true;
i++;
}
}
感謝您的幫助。
什麼'teams'價值? – Yuck 2012-02-20 21:37:17