I have a situation where I need to dynamically add a container onto a form, where I won't know the name of the container at designtime.
If I knew that the name of my container is UserControl1, I'd be doing something like the following in my form...
UserControl1 oControl = new UserControl1();
oControl.BringToFront();
oControl.Refresh();
this.Controls.AddRange(new System.Windows.Forms.Control[] {
oControl});
I'm writing this code as generic code in a form class, so I won't know the name of the container. I know that Rick Strahl has the stuff on his site for dynamic code evaluation, and was wondering if that's the way to go, or if there's a simpler way.
Thanks,
Kevin