1

I have a bunch of controls including labels, updown menu, combo boxes, radio buttons, and check boxes that must be replicated once someone hits the add button. Is there a way that I can create a layout with all of these and just replicate the layout, itself?

  • The GUI builder generates code for WinForms UIs. Use that as a starting point. – Adam Zuckerman Jul 11 '16 at 18:11
  • Why the downvotes? Simple answers don't mean it's a bad question. Sometimes people don't have the vocabulary they need to perform an effective search. I seriously hate this site's culture sometimes. Anytime someone mentions any flavor of old MS tech the DVs start flying. – RubberDuck Jul 11 '16 at 23:38
  • @RubberDuck: Look at the original revision. See the title? Now look at the first sentence of the post, containing the words "find a sample code." Notice the "most efficient way" declaration in the last sentence of the first paragraph? All told, not the best post anyone's ever written here, and certainly enough to explain the downvotes. Note that you have enough reputation to edit. – Robert Harvey Jul 19 '16 at 14:37
1

You want to create a user control. You can predefine the layout, much like you would with a Form, and then create and add a new instance of the control to a Form, just like you'd dynamically add a new label, text box, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.