I’m making a settings screen at the moment that will have a radiobutton group which will determine what controls are displayed. The different settings are contained within a UserControl.
I am dynamically creating this UserControl like so:
panel = new btSettings();
this.Controls.Add(panel);
panel.Location = new Point(15, 49);
Just wondering how I can access the fields within this control and design time when the object will only be created during run time?
Thanks.
You will need to use indirect references to do what you are wanting to do. Its been a while since I worked with user controls, but container controls should support a Controls (or Children) collection which will return the controls that exist in it. You will then need to iterate over them, cast them to the types you care about and work with them. For example: