Returns or sets a user-defined variant associated with the given column.
Syntax
[form!]VSFlexGrid.ColData(Col 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 ColData property:
Dim coll As New Collection
coll.Add "Hello"
coll.Add "World"
fg.ColData(1) = 212 ' store a number
fg.ColData(2) = "Hello" ' store a string
fg.ColData(3) = coll ' store a pointer to an object
fg.ColData(4) = Me ' store a pointer to a form
Debug.Print TypeName(fg.ColData(1)), fg.ColData(1)
Debug.Print TypeName(fg.ColData(2)), fg.ColData(2)
Debug.Print TypeName(fg.ColData(3)), fg.ColData(3).Item(2)
Debug.Print TypeName(fg.ColData(4)), fg.ColData(4).Caption
This code produces the following output:
Integer 212
String Hello
Collection World
Form1 Form1
Data Type
Variant