views:

193

answers:

1

I have a groupox in a VB.NET winform app. The groupbox contains a few Labels, Textboxes and Checkboxes. This was created by simply dragging the controls out of VS toolbox.

What I need to do is take the 1 Groupbox and at runtime create multiple Groupboxes to display based on user selection. Instead of dynamically creating the Groupboxes and other controls nested inside, is there a way to clone or copy the original one.

Then I'd just change the properties. Label text, Textbox text, etc. And the location of the Groupbox in the layout.

+1  A: 

What you could do is create a user control based upon your groupbox which would allow its reuse. You could then create the instances you require at runtime and add them to the form.

Maybe suggest that you look into creating user controls for winforms.

David
+1 Yeah, the easiest way would def be to create a user control with all that stuff.
smoore
Thanks!! That works great.
rioja