Load user control during the run time  
Author Message
Tammt





PostPosted: Visual C# General, Load user control during the run time Top

how can I load the user control into my main form during the run time

Thanks,

Tammy



Visual C#19  
 
 
Brendan Grant





PostPosted: Visual C# General, Load user control during the run time Top

At the very least it's just as easy as adding any other control, you need only create an instance and add it to the Controls collection of the parent container:

MyUserControl control = new MyUserControl();
this.Controls.Add(control);

You are free as well to put any additional init info you'd like between the two above lines.



 
 
Tammt





PostPosted: Visual C# General, Load user control during the run time Top

Thanks Brendan, it helps!