【发布时间】:2015-09-21 19:10:12
【问题描述】:
我使用了一个按钮来创建一组文本框,如下所示:
public partial class Form1 : Form
{
private int a = 75;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox1.Location = new System.Drawing.Point(50, a);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 0;
this.Controls.Add(this.textBox1);
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox2.Location = new System.Drawing.Point(200, a);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 0;
this.Controls.Add(this.textBox2);
this.button1.Location = new System.Drawing.Point(650, a);
a += 25;
}
}
因此,可能会为许多按钮点击创建许多 textbox1 和 textbox2。说 10 textbox1 和 10 textbox2。如何从所有这些中获取数据并存储在数据库中。每个 textbox1 和 textbox2 都在一行表格中?
欢迎任何帮助。
【问题讨论】: