110,499
社区成员
发帖
与我相关
我的任务
分享
private void btnAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(comboBox1.Text))
{
int n = Convert.ToInt32(comboBox1.Text);
for (int i = 0; i < n; i++)
{
TextBox txt1 = new TextBox();
txt1.Width = 100;
txt1.Height = 22;
txt1.Location = new Point(50, i * 22 + 3 * (i + 1));
TextBox txt2 = new TextBox();
txt2.Width = 100;
txt2.Height = 22;
txt2.Location = new Point(160, i * 22 + 3 * (i + 1));
Button btn = new Button();
btn.Width = 75;
btn.Height = 22;
btn.Location = new Point(260, i * 22 + 3 * (i + 1));
btn.Text = "删除";
this.Controls.Add(txt1);
this.Controls.Add(txt2);
this.Controls.Add(btn);
}
}
}