D.1. Create DataSource and Data Consumer Classes

A data source class is a VB class module that exposes an interface that can be used by the new BindingCollection object to bind data from a property of the class to a property of a form control. A Data Source Class can use any form of external data: a text file, a directory structure, or an ADO recordset are all examples of data that can be accessed via a VB data source class. A number of new properties have been added to VB class modules, one of which is the DataSourceBehavior property, which is set to vbDataSource to enable the class to be used as a data source.

A data consumer class is a VB class module that is bound to a form control that acts as a data source using the BindingCollection object. Another of the new properties that has been added to VB class modules is the DataBindingBehavior property, which is set to either vbSimpleBound or vbComplexBound to enable the class to be used as a data consumer.

For information on data source and data consumer classes, see Reference entry "Data Binding Objects (VB6)" in Chapter 7.

Get VB & VBA in a Nutshell: The Language 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.