TextBox tb=new TextBox();
tb.ID="da";
tb.Enabled=true;
tb.Visible=true;
tb.Width=1000;
tb.Height=10;
this.Controls[1].Controls.Add(tb);
tb.ID="da";
tb.Enabled=true;
tb.Visible=true;
tb.Width=1000;
tb.Height=10;
this.Controls[1].Controls.Add(tb);
PlaceHoder.Controls.Add(你的按钮控件)
PlaceHoder.Controls.AddAt(0,mybutton)
还有一个问题,当我用如下代码给动态按钮的Click建立委托时,总是提示说
方法“bug_manager.MainForm.CreateSqlDataAdapter()”与委托“void System.EventHandler(object, System.EventArgs)”不匹配Button bFunction = new Button();
bFunction.ID = i.ToString();
bFunction.Height = 20;
bFunction.Width = 100;
bFunction.Text = "test";
bFunction.Click += new System.EventHandler(this.CreateSqlDataAdapter);
PlaceHolder1.Controls.Add(bFunction);
方法声明如下:
public void CreateSqlDataAdapter()
{
}
{
}