473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

databinding to a combobox from webservice

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
3 7421
How do you initialize oDS??

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

Nov 23 '05 #2
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Richard | last post by:
Hi, I'm having issues with DataBinding. I have a Form with two data bound comboboxes on it. When you select something in one combobox I may {or may not} want to change the selected item in the...
13
by: Michael Maes | last post by:
Hi, I have a UserControl containing some controls of which one is a ComboBox. All the InternalControls are Private and some are allowed to be accessed through Public Methods. One of the things I...
1
by: Gary Shell | last post by:
I have a pair of combo boxes on a form. Both have their SelectedValue property bound to a column on a table called "Input_Output". One column is called "Class" and the second is called "SubClass"....
0
by: Kevin Hodgson | last post by:
I have a ComboBox and a TextBox bound to a Dataset/datatable returned from a SQL Database. The databinding is set in Design Mode. Everything works fine on my initial fill, and I get the correct...
5
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as...
5
by: Dennis | last post by:
I am trying to create a form using databinding to a dataset and one of the fields requires the user to select from a list of optons. Any hints on how to do this other than bind the field to a...
1
by: Rick Shaw | last post by:
Hi. I've struggling with the combobox databinding in C#. What I was trying to do was: - Hard code the items in the combobox's Items (collection) property. (ie. 'Mon', 'Tue', 'Wed', 'Thu',...
7
by: JTC^..^ | last post by:
When i attempt to bind to the "Text" and "Value" property of a combobox on a windows form the value is reset when I leave the combobox. The comboboxes contain the correct Text and Values. I know...
0
by: theleshie | last post by:
Hi, I am creating an application which dynamically creates forms depending on the information held in a dataset (which also includes the data the application itself uses). As part of dynamically...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.