I am trying to create controls at runtime by using an XML file. How would I access these controls after creating them with names specified by the XML file?
For instance, if I had a series of controls in an XML file:
<control id="0" type="textbox">
<param id="0" type="(name)">DynamicTextbox</param>
<param id="1" type="location">100,73</param>
<param id="2" type="size">119,20</param>
</control>
<control id="1" type="button">
<param id="0" type="(name)">DynamicButton</param>
<param id="1" type="location">200,82</param>
<param id="2" type="size">78,50</param>
</control>
If I designed the UI in design mode, and I didn’t use the XML file, I could simply call the controls with their respective names.
DynamicTextbox.location = new Point(100,73);
DynamicTextbox.size = new Size(119,20);
DynamicButton.location = new Point(200,82);
DynamicButton.size = new Size(78,50);
Since I am creating the controls at runtime, how would I access them with those names?
Thanks!
I take it you are adding the control to a UI element? YOu should be able to access them through that. So in WinForms you might have something like…
If this doesn’t help then let us know what type of application you are working with (WinForms, WPF, ASP.NET etc.)