Question : dynamically adding controls to a winform

I am trying to create a data entry application that has an element of user configuration.
An XML file should allow a user to add controls to a winform.
e.g.
<?xml version="1.0" encoding="utf-8" ?>
<!--Defines controls on a form-->
<Form name="TestForm">
<Control type="TextBox" name="txtAndy">
<Size width="100" height="20"></Size>
<LocationXY>51,30</LocationXY>
</Control>
<Control> ...... etc etc etc
</Form>

I can't find a way of creating the control using the "name" in the XML file.
If a variable ctlname holds the string "txtAndy" what command can I use to create the object called txtAndy?

this.txtbox= new System.Windows.Forms.TextBox();
is what I need to create but I can't work out how to use txtAndy instead of txtbox

ctlname = new System.Windows.Forms.TextBox();
will obviously fail

Hope someone can help

regards
andy





Answer : dynamically adding controls to a winform

If you are matching on the entire column instead of using a LIKE operation, yes, there is.

However, any time you start using functions or LIKE, you are basically tossing your indexes out the window.

Random Solutions  
 
programming4us programming4us