473,769 Members | 7,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetCounselo rs ' filling the dataset

cbCounselors.Da taSource = ds.Tables("Coun selors") 'combobox datasource

cbCounselors.Da taBindings.Add( "DisplayMember" , ds, "FullName") '

cbCounselors.Da taBindings.Add( "ValueMembe r", ds, "StaffID")

Any help will be appreciated.

dan
Nov 23 '05 #1
3 7438
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.Da taSource = ds.Tables("Coun selors") 'combobox datasource
cbCounselors.Da taBindings.Add( "DisplayMember" , ds.Tables("Coun selors"),
"FullName") '
cbCounselors.Da taBindings.Add( "ValueMembe r", ds.Tables("Coun selors"),
"StaffID")

Or even easier:

cbCounselors.Da taSource = ds.Tables("Coun selors")
cbCounselors.Di splayMember = "FullName"
cbCounselors.Va lueMember = "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.GetCounselo rs ' filling the dataset

cbCounselors.Da taSource = ds.Tables("Coun selors") 'combobox datasource
cbCounselors.Da taBindings.Add( "DisplayMember" , ds, "FullName") '

cbCounselors.Da taBindings.Add( "ValueMembe r", 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***@ceciltec h.com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.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.Da taSource = ds.Tables("Coun selors") 'combobox datasource
cbCounselors.Da taBindings.Add( "DisplayMember" , ds.Tables("Coun selors"),
"FullName") '
cbCounselors.Da taBindings.Add( "ValueMembe r", ds.Tables("Coun selors"),
"StaffID")

Or even easier:

cbCounselors.Da taSource = ds.Tables("Coun selors")
cbCounselors.Di splayMember = "FullName"
cbCounselors.Va lueMember = "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.GetCounselo rs ' filling the dataset

cbCounselors.Da taSource = ds.Tables("Coun selors") 'combobox

datasource

cbCounselors.Da taBindings.Add( "DisplayMember" , ds, "FullName") '

cbCounselors.Da taBindings.Add( "ValueMembe r", 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
1523
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 other combobox. For reasons beyond the scope of this post I need to change the second comboboxe's selected index from within a ColumnChanging event handler. So, inside a ColumnChanging event handler I change the value of the column that is bound to...
13
5345
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 would like to do (of course) is set the DataBindings. Something clearly is wrong with the approach I use, because I can't set the Properties in the Designer, the DataSource-Property appears like 'ReadOnly', there is no "dropdown" with the list from...
1
3624
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". Each combobox has its datasource, displaymember and SelectedValue member bound to separate tables thru individual datatsets thru individual data adapters. The two tables are "Class" and "SubClass". I use parameterized query to populate the...
0
987
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 list of items in the combobox, and the textbox which is bound to a second column in the same table, changes to the appropriate value when a new item is selected in the ComboBox. The ComboBox is displaying a list of products, and the texbox the...
5
3190
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 the value and displaymember properties. This works fine. My combobox contains the correct data. However I'm also binding my SelectedValue property to a column in a datatable. Here's where I'm lost. The combobox doesn't show the correct
5
1823
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 label or text box to display the current field value then add a combo box with the list of items to chose from? -- Dennis in Houston
1
2298
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', 'Fri') - Then databind the combobox to a table in the dataset. Since the table (in the dataset) contains just a tiny subset (1 to 5 records) of what is in the database, it might contain, for example, the values 'Mon' and 'Thu' only.
7
13531
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 this as the Value property binds correctly on it own. It is only when I bind the "Text" and "Value" that the issue occurs. The following sample code includes my custom classes and the Form Clode. I have several comboboxes and customer classes...
0
1314
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 creating these forms, I need to bind controls back to their underlying tables. This has been successful with textboxes, but I am having a lot of difficulty with comboboxes. Setting the datasource to the bindinglist seems to be ok, but I am having...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.