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

Data Sources Window showing relation

link to video For a video version of this topic, see How do I: Update Related Tables.

  1. Open your form in the Windows Forms Designer.

  2. Open the Data Sources window. For more information, see How to: Open the Data Sources Window.

  3. 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.)

  4. Drag any items you want to display from the parent table in the relationship from the Data Sources window onto your form.

  5. 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.


    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


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


TableAdapter Overview

Creating and Editing Typed Datasets

Data Sources Overview

Validating Data

Other Resources

Data Walkthroughs