Databinding Combobox

C

cbrown

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.
 
G

Guest

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
 
C

cbrown

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top