This documentation is archived and is not being maintained.

Visual Basic Reference

Visual Studio 6.0

DataFormat Property

See Also    Example    Applies To

Sets or returns the StdDataFormat object to which a bound object is attached. Read/write both at design time and run time.


object.DataFormat = formatobject

The DataFormat property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
formatobject Required. A StdDataFormat object.


The DataFormat property can also be set through a property page from the Properties window. If the setting in code differs from the property page, the property page setting is used for the first record fetched, and from then on the values in code will be used.

The DataFormat property of the DataCombo control is an Extender property. Therefore it's always visible on the property sheet and can be set in code. However the DataCombo control only formats the top item in its list. This can be disconcerting to the end user who sees a formatted top item, but is only given a list of unformatted items to select from. The formatted item may also mislead end users who assume the item will be entered in the database as formatted. For these reasons, it's advisable to not set the DataFormat property when using the DataCombo control.