Help Center

RowDataproperty

Returns or sets an arbitrary long value associated with each row.

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 RowData (BYVAL Index AS LONG) AS LONG
PROPERTY RowData (BYVAL Index AS LONG, BYVAL nData AS LONG)

Parameters

NameDescription
IndexThe 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