Monday, January 17, 2011

Create Button at Run Time In C #

for (int i = 0; i < 10; i++)
{
obj = new Button();
obj.Location = new Point(bt, 80);
newname = (btn + i).ToString();
obj.Name = "Table";
obj.Text = newname;
obj.Height = 50;
obj.Width = 80;
obj.Click += new EventHandler(obj_Click);
this.Controls.Add(obj);
bt += 90;
}

No comments:

Post a Comment