By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,064 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,064 IT Pros & Developers. It's quick & easy.

xml to combobox

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

------------------------

"Charlie Bartlett" <gi***********@gmail.com> wrote in message
news:sJ***************@newsfe3-win.ntli.net...
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
epeats -
System.Data.DataRowView - 3 times, help! what am I doing wrong??

thanks in advance

Charlie.

Nov 20 '05 #2

P: n/a
perfect....thanks.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

------------------------

"Charlie Bartlett" <gi***********@gmail.com> wrote in message
news:sJ***************@newsfe3-win.ntli.net...
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
epeats -
System.Data.DataRowView - 3 times, help! what am I doing wrong??

thanks in advance

Charlie.


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.