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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.