I have a series of controls, which are a dropdownstyle combobox, 3 labels, and 3 text boxes. I want to make it so in a button click event, a new set of these controls are listed exactly under it. Each new text box and combobox need their own individual names when added. I was thinking that the event could check if there was anything above it, and if true, it would place it just below the existing controls, but I don't know how to do this. I also was wondering how I can make it so the the windows form extends when the new information is added, allowing the user to enter as many controls as they'd like.
Asked
Active
Viewed 100 times
0
-
do a google search Anton F. there are tons of examples to explain this. this site is not designed for you to use to get answers without showing some efforts on your own ...what have you tried? – MethodMan Dec 28 '12 at 19:51
-
You're going to have to write code to do this. Start with this: http://stackoverflow.com/questions/4990624/wpf-add-controls-from-code – Jordan Kaye Dec 28 '12 at 19:52
-
I have tried, I usually do this to solve my problems but I don't know how to phrase this kind of things, so this was my last resort. – Agentgreen Dec 28 '12 at 19:54
-
3that's rather odd I typed in your exact question in google and came up with this http://stackoverflow.com/questions/1434282/how-do-i-create-5-buttons-and-assign-individual-click-events-dynamically and 20 other good examples – MethodMan Dec 28 '12 at 19:55
1 Answers
2
This question is kind of hard to follow, but I think you need to do two things:
Make this (combobox, 3 labels, 3 text boxes) set of controls a single, self-contained User Control. You'll add properties that allow you to get/set information from the sub-controls.
Programmatically add these user controls (on a button click, etc.) to a
FlowLayoutPanel
to keep them organized on-screen. Keep references to them in aList
or something, so you can access the data in them through the properties mentioned in 1.
There is a lot of information out there on how to use FlowLayoutPanel.

Jonathon Reinhart
- 132,704
- 33
- 254
- 328