tags:

views:

44

answers:

2

I need to display multiple pieces of data in a combobox, but I can't figure out how to do it.

Here's the code I'm trying to make work:

        innerBox.DisplayMember = @"t => t.TenantName + ""\t"" + t.Property.PropertyName + ""\t"" + t.RentalUnit.UnitNumber ";

But it doesn't work, this does though:

        innerBox.DisplayMember = @"t => t.TenantName";

How can I get the composite one to work?

+1  A: 

This is not possible.

Instead, you should add a property to your underlying objects.

SLaks
+1, Or override ToString() method
Nagg
A: 

DisplayMember can contain only single property name! If you want composite output, you should subscribe to Format event and compose output string in code.

arbiter
I think the Format event messes with my OwnerDraw DrawItem event.
Malfist
@Malfist, If your have owner draw combobox then why you bothering about DisplayMember? You can draw anything you wish, including any composite data string.
arbiter