| Data Format Objects (VB6) |
Library to Reference
Microsoft Data Formatting Object Library (../ SYSTEM32/MSSTDFMT.DLL)
Description
The Data Format objects can be used only in conjunction with the Data Binding objects, although their use isn't mandatory. They allow you to perform complex formatting operations with a minimum of code. For example, formatting null data or mapping a data field to a checkbox are common operations you had to code manually in almost all database applications. Now these operations can be handled with just a few lines of code.
The object model, which is shown in Figure 7.3, consists of a collection object, a format object, and a value object. For most applications, you want to create a formats collection object to hold the various format objects you use in the application, but you can also simply create a format object without using the collection. The value object isn't createable and is available only when it's passed to the format object's Format or Unformat events.
Figure 7.3. The Data Format object model

When you bind a data source to a control using the bindings collection, you can specify a Format object to bind with them. As data is read from the source, it's formatted and displayed automatically. When data is read from the control and written back to the data source, it's unformatted automatically. For complex formatting operations, you can use the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access