RowData Property

Returns or sets a user-defined variant associated with the given row.

Syntax

[form!]VSFlexGrid.RowData(Row As Long)[ = value As Variant ]

Remarks

The RowData and ColData properties allow you to associate values with each row or column on the control. You may also associate values to individual cells using the Cell(flexcpData) property.

A typical use for these properties is to keep indices into an array of data structures associated with each row, or pointers to objects represented by the data in the row or column. The values assigned will remain current even if you sort the control or move its columns.

Because these properties hold Variants, you have extreme flexibility in the types of information you may associate with each row, column or cell. The example below shows some ways in which you can use the RowData property:

   Dim coll As New Collection

   coll.Add "Hello"

   coll.Add "World"

   

   fg.RowData(1) = 212      ' store a number

   fg.RowData(2) = "Hello"  ' store a string

   fg.RowData(3) = coll     ' store a pointer to an object

   fg.RowData(4) = Me       ' store a pointer to a form

   Debug.Print TypeName(fg.RowData(1)), fg.RowData(1)

   Debug.Print TypeName(fg.RowData(2)), fg.RowData(2)

   Debug.Print TypeName(fg.RowData(3)), fg.RowData(3).Item(2)

   Debug.Print TypeName(fg.RowData(4)), fg.RowData(4).Caption

This code produces the following output:

Integer        212

String        Hello

Collection    World

Form1         Form1

You can search for rows that contain specific RowData values using the FindRow property.

Data Type

Variant

See Also

VSFlexGrid Control