Adding a control from an external class
I am transferring most of my codes on a separate class and along with it is a code that adds a control during runtime. How can I add a control in my groupbox from another class?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted Aug 28, 2007, 7:48 PM EDT
If your other class accepted the groupbox as an argument, you could allow your other class to add the control.
public static class OtherClass { public static void AddControl(GroupBox gbx) { Label lbl = new Label(); lbl.Text = "Five by Five"; lbl.Left = 10; lbl.Top = 15; gbx.Controls.Add(lbl); } }