using System; using System.Drawing; using System.Windows.Forms; namespace BuildField { public partial class Form1 : Form { private TextBox[] textBoxArray; public Form1() { InitializeComponent(); controlInit(); } private void controlInit() { int fieldCount = 25; textBoxArray = new TextBox[fieldCount]; for (int i = 0; i < fieldCount; i++) { this.textBoxArray[i] = new TextBox(); this.textBoxArray[i].Location = new Point(144, 29 + i * 35); this.textBoxArray[i].Name = $"textBox{i}"; this.textBoxArray[i].Size = new Size(588, 19); this.textBoxArray[i].TabIndex = i; this.Controls.Add(this.textBoxArray[i]); } Console.WriteLine($"フィールドを{fieldCount}個作成しました"); } } }