How to: Bind Objects to Windows Form Controls
The Entity Framework enables you to bind Windows Form controls such as a ComboBox or DataGridView to an EntityCollection or to an ObjectQuery result. We recommend that you not bind controls directly to an ObjectQuery. Instead, bind controls to the result of the Execute method. For more information, see Binding Objects to Controls.
The example in this topic is based on the Adventure Works Sales Model. To run the code in this example, you must have already added the AdventureWorks Sales Model to your project and configured your project to use the Entity Framework. To do this, complete the procedures in How to: Manually Configure an Entity Framework Project and How to: Manually Define the Model and Mapping Files.
The following example is from a Windows Form. When the form is loaded, an ObjectResult of SalesOrderHeader objects is returned by calling the Execute method of the ObjectQuery. This result is bound to a combo box. When an order is selected, the related EntityCollection of SalesOrderDetail objects is bound to a DataGridView control.