Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

databinding to a combobox from webservice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan Slaby - 02 Mar 2005 08:09 GMT
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
MasterGaurav - 02 Mar 2005 13:51 GMT
How do you initialize oDS??

--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
--------------------------------
cecil@ceciltech.com - 02 Mar 2005 20:03 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.