| 分類:[C#]
Windows 7 / Visual Basic 2010 C#
Textboxで多次元配列を用いた方法をご教示お願い致します。
Formロード時に9列×10行=計90個のTextboxを表示したいのですが、下記のような9列×1行までしかうまく対応出来ていません。行を増やすにはどうしたら良いでしょうか?
private System.Windows.Forms.TextBox[] testTextBox; private void Main_frm_Load(object sender, EventArgs e) { //ボタンコントロール配列の作成(ここでは5つ作成) this.testTextBox = new System.Windows.Forms.TextBox[9]; //ボタンコントロールのインスタンス作成し、プロパティを設定する this.SuspendLayout(); for (int i = 0; i < this.testTextBox.Length; i++) { //インスタンス作成 this.testTextBox[i] = new System.Windows.Forms.TextBox(); //プロパティ設定 this.testTextBox[i].Size = new Size(30, 30); this.testTextBox[i].Location = new Point(i * 30, 10); } //フォームにコントロールを追加 this.Controls.AddRange(this.testTextBox); this.ResumeLayout(false); } |