I want to load the usecontrol created in the project dynmically/programmtically. Eg: I have one form, and a number of usercontrols. The usercontrol should be pasted / loaded into the form.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
try abcPosted Nov 30, 2007, 4:18 AM
System.Windows.Forms.Button b1;
b1=new Button();
b1.Text=i.ToString();
b1.Width=35;
b1.Height=20;
b1.Top = 10;
b1.Left =20;
b1.Name="Mybutton";
b1.Click+=new EventHandler(ButtonClick); // if u want to add event handler
form1.Controls.Add(b1);