I am using VJ#.NET to make an application, and I am needing to read an XML file into a list box and then be able to rip out other elements from this XML file later.
An example from this XML file is:
I won't post the whole file, as it is over 6000 lines long.Code:<?xml version="1.0" encoding="ISO-8859-1"?> <itemdb> <item name="Dwarf remains" description="The body of a Dwarf savaged by Goblins." type="0" members="true"/> <item name="Tool kit" description="These could be handy." type="1" members="true"/>
I want to read this XML file, and then insert each <item> element's "name" attribute into a listbox named listBox1
How would I go about this? So far I have this:
VB Code:
DataSet dsItems = new DataSet("DataGrid"); String filePath = "Items.xml"; dsItems.ReadXml(filePath); dataGrid1.set_DataSource(dsItems); dataGrid1.set_DataMember("item"); dataGrid1.set_CaptionText(dataGrid1.get_DataMember());
Would I need the dataGrid to be able to do this? It outputs it perfectly fine into the dataGrid.




Reply With Quote