ClearStucturefunction
Clears any mapping information from the MSHFlexGrid that regards the order and name of the displayed columns.
Syntax
FUNCTION ClearStructure () AS HRESULT
Description
Reset the control's internal column mapping and band information when it is bound to a data source.
Remarks
Unlike the standard Clear method, which only empties cell content and formatting, ClearStructure removes the grid's underlying organizational metadata.
This method is primarily used in data-bound scenarios involving ADO or Shaped Recordsets.
When you change the RecordSource of a bound data control to a new query with a different number of columns or a different hierarchy (bands), the MSHFlexGrid often retains the column arrangement of the previous recordset.
Calling ClearStructure before assigning a new recordset forces the grid to "forget" its old layout and rebuild its columns and bands to match the new data structure automatically.
It is typically called immediately before setting a new DataSource or Recordset.
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid