Hi all,
This is my first post in Tek-Tips forum, hope can get some helps and guides from you all..
My question sound like this:
I'm currently develop a window base applicationin c#. So far, I had create a xml files and plan to load the data into combo box accordingly base on the node name, example:
a) Sample of XML files:
**********************************************
<Material>
<C>Ceramic</C>
<L>Glass</L>
</Material>
<Position>
<A>Axial</A>
<B>Bottom</B>
<D>Dual</D>
</Position>
***********************************************
So, there will be two different combo box, one to store 'Material' and the other one to store 'Position', i want the data such as Ceramic, glass load into first combo box, and data such as "Axial", "Bottom" into second combo box,
how can i do that.
I used XML TextReader but seem like i can't specify which node to load, the code will give me the whole things(ceramic, glass, axial, bottom, dual), here is the code i used:
*************************************************
xtr = new XmlTextReader(fileName);
xtr.WhitespaceHandling = WhitespaceHandling.None;
while (xtr.Read())
{
switch (xtr.NodeType)
{
case XmlNodeType.Text: this.cboMaterial.Items.Add(xtr.Value); break;
}
}
***************************************************
Any help is appreciated, please help and thanks..
This is my first post in Tek-Tips forum, hope can get some helps and guides from you all..
My question sound like this:
I'm currently develop a window base applicationin c#. So far, I had create a xml files and plan to load the data into combo box accordingly base on the node name, example:
a) Sample of XML files:
**********************************************
<Material>
<C>Ceramic</C>
<L>Glass</L>
</Material>
<Position>
<A>Axial</A>
<B>Bottom</B>
<D>Dual</D>
</Position>
***********************************************
So, there will be two different combo box, one to store 'Material' and the other one to store 'Position', i want the data such as Ceramic, glass load into first combo box, and data such as "Axial", "Bottom" into second combo box,
how can i do that.
I used XML TextReader but seem like i can't specify which node to load, the code will give me the whole things(ceramic, glass, axial, bottom, dual), here is the code i used:
*************************************************
xtr = new XmlTextReader(fileName);
xtr.WhitespaceHandling = WhitespaceHandling.None;
while (xtr.Read())
{
switch (xtr.NodeType)
{
case XmlNodeType.Text: this.cboMaterial.Items.Add(xtr.Value); break;
}
}
***************************************************
Any help is appreciated, please help and thanks..