|
-
Mar 4th, 2005, 10:08 AM
#1
Thread Starter
Junior Member
[RESOLVED] How to read XML file into a combo box ?
How do I read an XML file into a combo box ???
Last edited by anin; Mar 4th, 2005 at 03:57 PM.
Reason: [RESOLVED]
-
Mar 4th, 2005, 10:18 AM
#2
Hyperactive Member
Re: How to read XML file into a combo box ?
Load it into a Dataset and then loop the column you want into the combo box!
-
Mar 4th, 2005, 10:28 AM
#3
Thread Starter
Junior Member
Re: How to read XML file into a combo box ?
The below code doesn't work. What am I doing wrong ?
Dim ds As New DataSet
ds.ReadXml("c:\\tirebrand.xml")
'cb1.DisplayMember = "host_Text"
'cb1.DataSource = ds.Tables("host")
neither this.
Dim dom As New Xml.XmlDocument
dom.Load("c:\\tirebrand.xml")
cb1.Items.Clear()
For Each node As Xml.XmlNode In dom.SelectNodes("host")
cb1.Items.Add(node.InnerText)
Next
thanks.
-
Mar 4th, 2005, 10:42 AM
#4
Thread Starter
Junior Member
Re: How to read XML file into a combo box ?
My XML file looks like:
Code:
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
- <BRAND>
<BRAND_CODE>01</BRAND_CODE>
<BRAND>AVON</TIRE_BRAND>
</BRAND>
- <BRAND>
<BRAND_CODE>02</BRAND_CODE>
<BRAND>LANCOME</TIRE_BRAND>
</BRAND>
and I have to read this into 2 combo boxes that is brandcode and brandname
and when I tried something like
VB Code:
Dim reader As New XmlTextReader("C:\tirebrand.xml")
While reader.Read()
cb1.Items.Add(reader.Name)
End While
it populates the name tags like "BRAND", "BRAND_CODE", "BRAND"... how do I read the brand code and brand name data and not the tag?
Last edited by anin; Mar 4th, 2005 at 01:54 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|