databinding to a combobox - Valuemember

haezeban

Member
Joined
Feb 8, 2004
Messages
5
Hey,

I try to bind a datasource to my combobox. The datasource is an array of objects.

Then I set the cmb01.displaymember = "Propertyname1".
Till here everything works fine.
But then I will also set the valuemember like this :
cmb01.ValueMember = "PopertyName2".

At runtime I receive always following exception :

"Could not bind to new display member. Parametername is newdisplaymember"


What will this mean? And how I have to resolve it?

Tkx,
Jac
 
Suppose the name of your dataset is ds. Try this:
Code:
cmb01.DataSource = ds.Tables(0)
cmb01.DisplayMember = "PropertyName1"
cmb01.ValueMember = ds.Tables(0).Columns(0).ToString
Hope that helps.
 
Spiel,

I found if the second property wasnt a property but a field.
So, I changed it to a property and now it works.

Thx
 
Back
Top