RowPositionproperty
Sets the position of an MSHFlexGrid row, allowing you to move rows to specific positions.
Syntax
PROPERTY RowPosition (BYVAL Index AS LONG, BYVAL newPos AS LONG) AS LONG
Parameters
| Name | Description | |
|---|---|---|
Index | The current zero-based index of the row you wish to move. | |
newPos | The target zero-based index where the row should be placed. |
Description
Sets the position of an MSHFlexGrid row, allowing you to move rows to specific positions
Remarks
Unlike the RowPos property (which returns a coordinate), RowPosition is a write-only property used to reorder rows.
When a row is moved, the other rows automatically shift to accommodate the change. For example, moving Row 5 to Position 1 will push the original Row 1 down to Position 2.
Moving a row via RowPosition preserves all cell contents, individual cell formatting (CellBackColor, etc.), and row-specific metadata.
In a hierarchical display, RowPosition typically operates within the context of the current band or the top-level structure.
Examples
' Moves the row currently at index 9 to index 1 grid.RowPosition(9) = 1
' Moving Row 2 to Position 3 effectively swaps them grid.RowPosition(2) = 3
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid