Help Center

DataMemberproperty

Returns or sets the data member.

Windowspropertydoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

PROPERTY DataMember () AS DWSTRING
PROPERTY DataMember (BYREF wszDataMember AS WSTRING)

Parameters

NameDescription
wszDataMemberSpecefies the table or child recordset to display.

Description

Returns or sets the data member.

Remarks

MSHFlexGrid's DataMember property specifies which table to display when the DataSource is a complex object like a hierarchical Recordset, allowing the grid to bind to a specific part of that data, like "Customers" from a Recordset containing "Customers" and "Orders" tables. It tells the grid which specific table name within the larger data source to use for populating rows and columns, essential for displaying related data sets.

A known bug exists where rebinding to a different DataMember may cause an error if the DataSource isn't reset first. To resolve this, set the DataSource = NULL before rebinding to a new data member or environment.

Simply changing the DataMember or calling Refresh often does not update the data if the underlying recordset has changed. Developers frequently need to manually reassign the DataSource to force a UI update.

To avoid errors and ensure a clean refresh, follow this binding sequence:

Set DataMember first: It is often recommended to set the DataMember string before assigning the DataSource. This ensures that when the binding is initialized, the grid already knows which specific data list to load.

Assign DataSource: Set the DataSource last to trigger the actual data retrieval and UI population.

Clear Structure (Optional): If you are rebinding a grid to a different data member, use the ClearStructure method first to remove old column mappings and bands.

Reference