动态添加控件至Panel

背景:VisualStuio2005;
              动态添加控件至Panel;
实现:
        int textBoxNum;
        int ButtonNum;
        textBoxNum = Convert.ToInt32(this.TextBox1.Text);
        ButtonNum = Convert.ToInt32(this.TextBox2.Text);
        for (int i = 0; i < textBoxNum; i++)
        {
            this.Panel1.Controls.Add(new TextBox());
        }
        for (int j = 0; j < ButtonNum; j++)
        {
            this.Panel1.Controls.Add(new Button());
        }

你可能感兴趣的:(职场,休闲)