Visual Basic: MSFlexGrid/MSHFlexGrid Controls

Visual Studio 6.0

DataField Property (MSHFlexGrid)

SeeAlso    Example    Applies To

Returns the name of the field bound to the specified column in the specified band. This property is read-only.


object.DataField(number, index) [= string]

The DataField property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
number A Long value that specifies the band that contains the column to affect.
index A Long value that either specifies the column to get, or sets the binding field.
string A string expression that evaluates the name of one of the fields in the Recordset object specified by the data provider.


When number is unspecified, it defaults to 0. Hence, when the MSHFlexGrid is not bound to a hierarchical Recordset, using 0 and not specifying number both have the same result.

If the MSHFlexGrid is not bound and the number and index are valid, DataField returns an empty string.

If a Refresh is executed after the DataProvider property is changed, the Recordset object may have different fields. This may invalidate the DataField settings of the bound columns and produce a trappable error.