不能指望別人把所有代碼寫給妳.學習呀. Button b = new Button(); b.text=ds.tables[0].rows[0][0].tostring(); b.Location = new Point(你想要的坐标); this.Controls.Add(b);
你用DataSet读数据 然后 foreach(DataRow r in DataSet.Tables["你的表名称或索引"].Rows) { Button b = new Button(); b.text=r.tostring(); b.Location = new Point(你想要的坐标); this.Controls.Add(b);}
{
Button b = new Button();
.....//给button赋需要的属性或者事件
b.Location = new Point(你想要的坐标);
}
如
this.Controls.Add( yourNewButton );
Button b = new Button();
b.text=ds.tables[0].rows[0][0].tostring();
b.Location = new Point(你想要的坐标);
this.Controls.Add(b);
然后
foreach(DataRow r in DataSet.Tables["你的表名称或索引"].Rows)
{
Button b = new Button();
b.text=r.tostring();
b.Location = new Point(你想要的坐标);
this.Controls.Add(b);}