Example of binding XML node to comboBox?

G

Guest

to Is there an easy way, to bind some xmlNodeList? I tried to write a public
class property that read the xmlNode and returned List(Of String) containing
the element names, which are what I want to display in the comboBox. I'm
finding millions of examples of simple databinding to a text box, or binding
datatable to datagridview.... but not much on comboBoxes or XML. Thanks for
anything.
 
G

Guest

Hi,
I would suggest you to convert XMLNodeList into Datatable.You can something
like this:
Dim TableNode as XmlNodeLIst = Node.SelectNodes("NewDataSet/Table")
Dim DT as new Data.DataTable
For I as integer = 0 to TableNode.ChildNodes.Count -1
DT.Columns.Add(TableNode.ChildNodes(i).Name.ToString)
Next
Dim Row as Data.DataRow = DT.NewRow
For I as integer = 0 to TableNode.ChildNodes.Count -1
Row(TableNode.ChildNodes(i).Name.ToString) =
TableNode.ChildNodes(i).InnerXml.ToString
Next
DT.Rows.Add(Row)
ref:http://groups.google.com/group/DotNetDevelopment/browse_thread/thread/64e3d81c34d5edab
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top