Create a Custom Record Browser

Problem

You want to synchronize multiple controls on a form.

Solution

Use data binding with the fields in a DataTable.

Discussion

Recipe Synchronize Controls on a Form showed how you could use data binding to synchronize multiple controls on a Windows Form to a collection of custom objects. The same technique is possible with the DataSet.

As an example, consider the form shown in Figure 14-1. It includes four data-bound controls: a list box, two labels, and a text box. These controls are synchronized, so when you make a new selection in the list box, the other controls are updated with the data from the row. In addition, you can move from row to row using the Next and Prev buttons. Changes are supported for any editable ...

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.