Hi Folks,
I am writing a windows forms application. In this application I have a config(xml) file which contains the information about the controls.
See the sample below. I want to be able to draw these controls from this xml file. also the code should be flexible enough to draw any new control i add to my xml file.
control type="Label" id="label1" width="23" height="23" xPos="117" yPos="100"
control type="TextBox" id="textBox1" multiline="false" width="143" height="23" xPos="117" yPos="50"
control type="Button" id="button1" width="23" height="23" xPos="100" yPos="100"
Your help will be much appreciated.
Drawing controls from xmlfile
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

msx3 reputationPosted Feb 13, 2007, 2:04 PM EST
Will8 reputationPosted Feb 21, 2007, 4:42 AM EST
or
Instead of using your own format for the XML file, use a DataSet.WriteXML and DataSet.ReadXML.
This stores a table in XML format, which is fairly simple to use and add to manually.
All you have to do is call ReadXML() at the beginning of your program, and the data table that comes out is very easy to parse.
i.e. dsMyDataSet.Tables[0].Rows[0].ItemArray[0]; is the first element.
I would suggest including a primary key value, makes it easier to determine when you've hit the end of your table.
Good luck!