Create a Master-Details Form

Problem

You need to create a form that allows users to navigate a parent-child relationship.

Solution

React to the CurrencyManager.PositionChanged event for the parent table, and update the DataView.RowFilter used for the child table.

Discussion

You can create a master-details form using data binding and row filtering. In this case, you need to bind two separate tables. The row position will be tracked separately for each table. When a row is selected in the parent table, you can configure the child table to show only the related rows by modifying the corresponding DataView.RowFilter property (as introduced in recipe Filter or Sort Data with a DataView). Figure 14-3 shows an example with two DataGrid controls. The top-most ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.