logo search
Учебник_ПОА

To display related data on a form

  1. On the File menu, click New Project.

  2. In the New Project dialog box, click Windows Application, and then click OK.

A new Windows Forms project opens.

  1. Add a connection to the sample database named Northwind.sdf as described in How to: Connect to a Database.

  2. On the Data menu, click Show Data Sources.

The Data Sources window opens.

  1. In the Data Sources window, expand NorthwindDataSet, and then expand Products.

  2. Click the drop-down arrow next to Product Name, and then click Label.

  3. Drag the Product Name field to the Windows Form.

  4. Drag the Order Details table (the one that is located in the Products table) to the form, and position it under the label.

A DataGridView control is added to the form.

  1. Press F5 to run the program.

  2. When the application opens, click the Move Next Item button on the ProductsBindingNavigator at the top of the form.

  3. Verify that the order detail information in the DataGridView control is updated whenever the product changes.