日期:2014-05-18 浏览次数:21023 次
        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);
                }
            }
        }