Share via


ColPosition, RowPosition Properties (ModHFGrid)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

ColPosition sets the position of a ModHFGrid column, making it possible for you to move columns to specific positions.

RowPosition sets the position of a ModHFGrid row, making it possible for you to move rows to specific positions.

Syntax

object.ColPosition(index, number) [= value]
object.RowPosition(number) [= value]

Syntax for the ColPosition and RowPosition properties has these parts:

Part Description
object An object expression that evaluates to the ModHFGrid Control object.
index A Long value that specifies the column to be moved.
number Optional. A Long value that specifies the band containing the column to be moved.
value Integer. A numeric expression that specifies the new position of the column or row.

Remarks

In the ModHFGrid, when BandNumber is not specified, it defaults to 0. Therefore, when the grid is not bound to a hierarchical Recordset, using 0 for BandNumber and not specifying BandNumber both have the same result. Note that BandNumber is an optional parameter for backward compatibility with the MSFlexGrid.

The index and setting must correspond to valid row or column numbers (in the range 0 to Rows – 1 or Cols – 1); otherwise, an error is generated.

When a row or column is moved using the RowPosition and ColPosition properties, all formatting information moves with it. This includes width, height, alignment, colors, and font properties. To move text only, use the Clip property.

Example

When implemented, the following code causes a column to move to the first position (the leftmost column) when the user clicks the column.

Sub ModHFGrid1_Click ()
   ModHFGrid1.ColPosition(MSFlexGrid1.MouseCol) = 0
End Sub

See Also

ModHFGrid Control