data source based on custom business objects

Oct 21 2006 12:37 PM
I have a problem that's bugging me for a month now. I hope someone can help me solve it. I'm trying to make a data source based on some classes and bind it to a BindingSource object. The classes: public class City { private Int32 _ID; private string _Name; ... } public class Customer { private Int32 _ID; private string _FirstName; private string _LastName; private City _LivesIn; ... } public class CustomerList : System.Collections.CollectionBase { ... } Here's what I've been doing: 1. create a data source based on the Customer class and drag it on a form (creates a binding source) 2. on the form load event create an instance of the CustomerList class and load all the customers from the database 3. set the binding source's data source property to the CustomerList object 4. bind a data grid view to the binding source The Problem: In the data grid I can't display the name of the city for each customer. All I get is "MyNamespace.LivesIn". I tryed to create a new column with a lookup combo box, as with datasets, but it didn't work.

Answers (3)