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

databinding to a combobox from webservice

P: n/a
I have a webservice that I want to populate a combobox on a windows form.
The webservice creates the correct XML output, but when I attempt to bind it
to a combobox I get this error:

Additional information: Cannot bind to property or column FullName on
DataSource.

This error occurs with the databindings. Here is the code:

--
Dim oDS As New DataService ' This is the webservice

Dim ds As New DataSet ' dataset to fill

ds = oDS.GetCounselors ' filling the dataset

cbCounselors.DataSource = ds.Tables("Counselors") 'combobox datasource

cbCounselors.DataBindings.Add("DisplayMember", ds, "FullName") '

cbCounselors.DataBindings.Add("ValueMember", ds, "StaffID")

Any help will be appreciated.

dan
Nov 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
How do you initialize oDS??

--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
--------------------------------

Nov 23 '05 #2

P: n/a
Dan,
Your problem has nothing to do with using a web service. It is
the databinding code that is wrong. To fix your code:

cbCounselors.DataSource = ds.Tables("Counselors") 'combobox datasource
cbCounselors.DataBindings.Add("DisplayMember", ds.Tables("Counselors"),
"FullName") '
cbCounselors.DataBindings.Add("ValueMember", ds.Tables("Counselors"),
"StaffID")

Or even easier:

cbCounselors.DataSource = ds.Tables("Counselors")
cbCounselors.DisplayMember = "FullName"
cbCounselors.ValueMember = "StaffID"

Cecil Howell
www.ceciltech.com

Dan Slaby wrote:
I have a webservice that I want to populate a combobox on a windows form. The webservice creates the correct XML output, but when I attempt to bind it to a combobox I get this error:

Additional information: Cannot bind to property or column FullName on DataSource.

This error occurs with the databindings. Here is the code:

--
Dim oDS As New DataService ' This is the webservice

Dim ds As New DataSet ' dataset to fill

ds = oDS.GetCounselors ' filling the dataset

cbCounselors.DataSource = ds.Tables("Counselors") 'combobox datasource
cbCounselors.DataBindings.Add("DisplayMember", ds, "FullName") '

cbCounselors.DataBindings.Add("ValueMember", ds, "StaffID")

Any help will be appreciated.

dan


Nov 23 '05 #3

P: n/a
Thank you. I figured it out and matches your first databinding snippet. The
second didn't work for some reason.

Dan
<ce***@ceciltech.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Dan,
Your problem has nothing to do with using a web service. It is
the databinding code that is wrong. To fix your code:

cbCounselors.DataSource = ds.Tables("Counselors") 'combobox datasource
cbCounselors.DataBindings.Add("DisplayMember", ds.Tables("Counselors"),
"FullName") '
cbCounselors.DataBindings.Add("ValueMember", ds.Tables("Counselors"),
"StaffID")

Or even easier:

cbCounselors.DataSource = ds.Tables("Counselors")
cbCounselors.DisplayMember = "FullName"
cbCounselors.ValueMember = "StaffID"

Cecil Howell
www.ceciltech.com

Dan Slaby wrote:
I have a webservice that I want to populate a combobox on a windows

form.
The webservice creates the correct XML output, but when I attempt to

bind it
to a combobox I get this error:

Additional information: Cannot bind to property or column FullName on

DataSource.

This error occurs with the databindings. Here is the code:

--
Dim oDS As New DataService ' This is the webservice

Dim ds As New DataSet ' dataset to fill

ds = oDS.GetCounselors ' filling the dataset

cbCounselors.DataSource = ds.Tables("Counselors") 'combobox

datasource

cbCounselors.DataBindings.Add("DisplayMember", ds, "FullName") '

cbCounselors.DataBindings.Add("ValueMember", ds, "StaffID")

Any help will be appreciated.

dan

Nov 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.