How to: Display Related Data in a Windows Forms Application
You can display related data by dragging items that share the same main table node from the Data Sources Window onto your form. For example, if you have a data source that has a Customers table and a related Orders table, you would see both tables as top-level nodes (in the tree view) in the Data Sources window. Expand the Customers node so that you can see the columns, and you will notice that the last column in the list is an expandable node representing the Orders table. This node represents the related orders for a customer. This means that if you want to create a form that allows you to select a customer and then display a list of orders for that customer, you would drag the items you want to display from this single hierarchy.
Creating data-bound controls that display related records
For a video version of this topic, see How do I: Update Related Tables.
To create controls that display related records
Open your form in the Windows Forms Designer.
Open the Data Sources window. For more information, see How to: Open the Data Sources Window.
Expand the node representing the parent table in the relationship. (The parent table is the table on the "one" side of a one-to-many relationship.)
Drag any items you want to display from the parent table in the relationship from the Data Sources window onto your form.
Related child tables appear as expandable nodes at the bottom of the parent table's column list. Drag the item(s) that you want to display from such a related node onto your form.
Note
Dragging an item from a top-level nodes creates a separate unrelated BindingSource Component that does not facilitate navigating the related records. To bind related data you must select the tables from the same hierarchical node.
See Also
Tasks
Walkthrough: Displaying Data on a Windows Form
How to: Connect to Data in a Database
How to: Navigate Data with the Windows Forms BindingNavigator Control
Concepts
What's New in Data Application Development