I have a loop in vb.net where I am wanting to display 50 panels, all with the same 3 controls. Only the last control is populated with the 3 controls, why is this?
Dim PanelVerticalPoint As Integer = btDF.Height * 6
For counter = 1 To 50 Step +1
Dim ButtonPanel As Panel = New Panel
ButtonPanel.Location = New Point(0, PanelVerticalPoint)
ButtonPanel.Size = New Size(btDF.Width, btDF.Height)
PanelVerticalPoint = PanelVerticalPoint + btDF.Height
You have to add a new instance of the buttons to each panel. You are adding the same button instance to the panels so each add is really moving the button.
It's not easy to clone a control. It looks like your case might be appropriate for a user control instead. Make the user control in the designer with the buttons and text box, then just create many instances of the user control instead of the panel.
Here's a very similar question with that kind of answer Clone Winform control