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
How do you initialize oDS??
--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.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
> 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.
>
[quoted text clipped - 16 lines]
>
> dan
Dan Slaby - 03 Mar 2005 01:30 GMT
Thank you. I figured it out and matches your first databinding snippet. The
second didn't work for some reason.
Dan
> Dan,
> Your problem has nothing to do with using a web service. It is
[quoted text clipped - 44 lines]
>>
>> dan