PDA

Click to See Complete Forum and Search --> : manipulating an XML


King Abadon
May 15th, 2007, 01:51 AM
<?xml version="1.0" ?>
- <Aparate>
- <Aparat>
<Denumire>AF MARINCA SAECO 1P</Denumire>
<NumarCitire>156</NumarCitire>
<DataCitire>31.10.2007</DataCitire>
<ContorGeneralInitial>817</ContorGeneralInitial>
<ContorGeneralFinal />
- <Pozitii>
- <Pozitie>
<Produs>Cafea espress</Produs>
<ContorInitial>817</ContorInitial>
<ContorFinal />
</Pozitie>
- <Pozitie>
<Produs>Cafea cu lapte</Produs>
<ContorInitial>317</ContorInitial>
<ContorFinal />
</Pozitie>
</Pozitii>
<Denumire>LAVAZZA</Denumire>
<NumarCitire>112</NumarCitire>
<DataCitire>31.10.2007</DataCitire>
<ContorGeneralInitial>144</ContorGeneralInitial>
<ContorGeneralFinal />
- <Pozitii>
- <Pozitie>
<Produs>Cafea espress</Produs>
<ContorInitial>817</ContorInitial>
<ContorFinal />
</Pozitie>
- <Pozitie>
<Produs>Cafea cu lapte</Produs>
<ContorInitial>317</ContorInitial>
<ContorFinal />
</Pozitie>
- <Pozitie>
<Produs>Capucino</Produs>
<ContorInitial>123</ContorInitial>
<ContorFinal />
</Pozitie>
</Pozitii>
</Aparat>
</Aparate>

i put in a combo Denumire.So i have 2 items in the combo
Now,how can i ,when i select from the combo one of the 2 itmes,put in a grid the right data?

the code i use to insert items in combo is this
XmlDocument xd = new XmlDocument();
xd.Load("contor.xml");
XmlNodeList xnd = xd.SelectNodes(@"Aparate/Aparat/Denumire");
foreach (XmlNode xn in xnd)
{
string sDenumire = xn.InnerText;
this.comboBox1.Items.Add(sDenumire);
}

JenniferBabe
May 16th, 2007, 09:30 PM
How about creating an event handle with the combo box, when it is clicked, retrive the values, and take those values and add it to the grid.

The combo box has a lmethod for retrieving the data selected.