动态生成的各个控件
他们的属性不同,这样怎样写?

解决方案 »

  1.   


                //添加button
                 Button BTN=new Button() ;
                 BTN.Name = "Dy_Button";          //设定名称
                 BTN.Location = new Point(100, 200);        //设定位置
             //。其他属性设置
                 this.Controls.Add(BTN);            //添加textbox
                 TextBox TB = new TextBox();
                 TB.Name = "TXT";
                 TB.ReadOnly = true;
                 this.Controls.Add(TB);
      

  2.   

    for (i = 1; i < 21; i++)后产生的各个控件,每个控件的属性都不一样,怎样去解决?
      

  3.   

    各个控件的name肯定不一样啊
    直接button1.Location = new Point(100, 200);    
        textbox1.ReadOnly = true;