xml to combobox

  • Thread starter Thread starter Ken Tucker [MVP]
  • Start date Start date
K

Ken Tucker [MVP]

Hi,

You have the column name wrong. The displaymember is case
sensistive. Try this

Dim dsData As New DataSet

dsData.ReadXml("serverlist.xml")

ComboBox1.DataSource = dsData.Tables(0)

ComboBox1.DisplayMember = dsData.Tables(0).Columns(0).ColumnName



Ken
 
I have been trying to bind a simple xml file to a combobox, here is the code
I have been using

Dim dsData = New DataSetds
dsData.ReadXml("serverlist.xml")
ComboBox1.DataSource = dsData.Tables(0)
ComboBox1.DisplayMember = "server"

and here is the xml file contents

<conf>
<server>server1</server>
<server>server2</server>
<server>server3</server>
</conf>


However instead of filling the combobox with the required data it repeats -
System.Data.DataRowView - 3 times, help! what am I doing wrong??

thanks in advance

Charlie.
 
perfect....thanks.

Ken Tucker said:
Hi,

You have the column name wrong. The displaymember is case
sensistive. Try this

Dim dsData As New DataSet

dsData.ReadXml("serverlist.xml")

ComboBox1.DataSource = dsData.Tables(0)

ComboBox1.DisplayMember = dsData.Tables(0).Columns(0).ColumnName



Ken
 

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

Back
Top