Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I set ComboBox DisplayMember to a Child Object's property that Has a relationship with Parent Object.

For Example. Bus is a parent class, but a Bus HAS an Engine which is a child class.

ComboBox.DisplayMember = Bus.Engine.HorsePower;
Posted

1 solution

Hi,

You just have to assign datasource first to combobox. Apply appropriate join to fetch data in desired structure which have properties of both parent and child classes. Then set display member and value member.
 
Share this answer
 
Comments
Admire Mhlaba 11-Aug-14 16:49pm    
Thank you for the response Gautam Raithatha. Kindly shed a bid of light on how to apply "Appropriate join to fetch data in desired structure". Code snippet will be highly appreciated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900