Hi!
I have two objects: User and Client, both implements interface IMember
interface IMember
{
int Id { get; set; }
string Name { get; set; }
}
In a form I set ListBox data source:
myListBox.DisplayMember = "Name";
myListBox.ValueMember = "Id";
myListBox.DataSource = membersList; // List<IMember>
And wierd things happen ;) When I run program the first object, whichis type of User, displays correctly (Adrian Serafin) and other objects, wich are type of Contact are displayed like this:
MyProject.Client#20
MyProject.Client#40
as for display was ToString() call on them.
I can't using list of different objects implementing the same interface as datasource in ListBox or I made some mistake here?