473,566 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Databinding Combobox

I am binding a custom collection to a combobox, which gives me no
errors, but displays

PintClub.Member

for each entry. How can I set the displaymember and valuemember fields
correctly. Do I need to inherit anything in my collection for this.
The collection "MemberCollecti on" contains "Member" objects with public
properties available. The collection inherits CollectionBase.

Dec 8 '05 #1
2 1356
cbrown,

When you say that the Member objects have public properties, do you mean
public properties with Get/Set methods, or do you mean public variables
(fields)?

Databinding requires properties with Get/Set methods.

Kerry Moorman
"cb****@duclaw. com" wrote:
I am binding a custom collection to a combobox, which gives me no
errors, but displays

PintClub.Member

for each entry. How can I set the displaymember and valuemember fields
correctly. Do I need to inherit anything in my collection for this.
The collection "MemberCollecti on" contains "Member" objects with public
properties available. The collection inherits CollectionBase.

Dec 8 '05 #2
I should have stated they have get/set.

Also, I found my answer, which of course was obvious, but still alluded
me.

I set the following:

cboMemberList.D ataSource = Members
cboMemberList.D isplayMember = "SelectionN ame"
cboMemberList.V alueMember = "MemberID"

Hope this helps someone else.

Dec 8 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1511
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...
13
5329
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...
1
3618
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...
0
980
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...
3
7430
by: Dan Slaby | last post by:
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: --
5
3175
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...
5
1816
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
2280
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...
7
13521
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...
0
1302
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...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
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...
0
6263
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...
0
5213
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
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
0
926
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...

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.