Example of binding XML node to comboBox?

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top