Selecting a Calculated Field

The ContactsList program is a big improvement over program Contacts but record selection is still a little awkward. The program lets the user pick a record from a list of LastName field values. It would be better if the list included the FirstName field as well. Then if the database had many records with a LastName value of Stephens, you could decide exactly which of the records to select.

You cannot bind the ListBox’s DisplayMember property to more than one data source field, but you can add a calculated field that combines the LastName and FirstName fields to the data source. First, modify the data adapter so it selects the calculated field. Click on the daContacts object and click the Configure Data Adapter link ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

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