これは私のコードです。 しかし、私のテキストボックスの値はすべてnullです。複数のテキストボックスを動的に作成する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