By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,932 Members | 1,486 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,932 IT Pros & Developers. It's quick & easy.

Databinding Combobox

P: n/a
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 "MemberCollection" contains "Member" objects with public
properties available. The collection inherits CollectionBase.

Dec 8 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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 "MemberCollection" contains "Member" objects with public
properties available. The collection inherits CollectionBase.

Dec 8 '05 #2

P: n/a
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.DataSource = Members
cboMemberList.DisplayMember = "SelectionName"
cboMemberList.ValueMember = "MemberID"

Hope this helps someone else.

Dec 8 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.