RowDataproperty
Returns or sets an arbitrary long value associated with each row.
Syntax
PROPERTY RowData (BYVAL Index AS LONG) AS LONG
PROPERTY RowData (BYVAL Index AS LONG, BYVAL nData AS LONG)
Parameters
| Name | Description | |
|---|---|---|
Index | The zero-based index of the row. |
Description
Returns or sets an arbitrary long value associated with each row. This property is an array that stores a Long for every row in the grid. It is purely for developer use and is never visible to the end-user.
Remarks
It allows you to link a visual grid row to a specific record ID in a database without needing to display that ID in a visible column.
One of the most important features of RowData is that the value stays with the row. If you sort the grid or move rows using RowPosition, the RowData value moves automatically with its associated row content.
Since RowData only accepts Longs, if you need to store a hidden string (like a GUID), you must instead use a hidden column (setting ColWidth(index) = 0).
Example
' 1. Storing the ID (Unbound mode) grid.AddItem "John Smith" grid.RowData(grid.Rows - 1) = 1042 ' Hidden Primary Key
' 2. Retrieving the ID during a Click event Dim selectedID As Long selectedID = grid.RowData(grid.Row) PRINT "You selected Record ID: " & STR(selectedID)
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid