Reputation: 45
I need to dynamically duplicate a Panel with all the controls within it according to the checkboxes. (If check-box is checked another panel appears).
Finally, when I click Calculate it's doing the same pre-defined action for each panel that created.
Picture to understand:
Can someone tell me how to do that?
Upvotes: 3
Views: 3913
Reputation: 17724
Put the controls you want into a UserControl.
When a checkbox is checked, created an instance of that control and add it.
MyPanel myPanel = new MyPanel();
myPanel.Location = new Point(25,25);
this.Controls.Add (myPanel);
Location is where you want it in your form.
Upvotes: 3