ComboBox IList<T> DataBinding

C

Claude

Hi,

I have a class A that contains an attribut of type class B :

public class A
{
private B _bee;
...

public B Bee
{
get { return _bee; }
set { _bee = value; }
}
...
}

public class B
{
private string _name;
...

public string Name
{
get { return _name; }
set { _name = value; }
}
...
}

In the program, I get a "IList<A> _as" that I bind to a combobox.

cboAs.DisplayMember = ????
cboAs.DataSource = _as;

I want the displayMember to be A.Bee.Name. How can I do that ? I tried to put
cboAs.DisplayMember = "Bee.Name"; but it doesn't seem to work.

Thanks,
Claude
 

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