TopRow Property

Returns or sets the zero-based index of the topmost non-fixed row displayed in the control.

Syntax

[form!]VSFlexGrid.TopRow[ = value As Long ]

Remarks

Setting the TopRow property causes the control to scroll through its contents vertically so that the given row becomes the top visible row. This is often useful when you want to synchronize two or more controls so that when one of them scrolls, the other scrolls as well.

The following code selects an arbitrary row and makes it the topmost row displayed in the grid:

  Private Sub Command1_Click()

     fg.SelectionMode = flexSelectionListBox

     fg.IsSelected(5) = True

     fg.TopRow = 5

  End Sub

To scroll horizontally, use the LeftCol property.

When setting this property, the largest possible row number is the total number of rows minus the number of rows that will fit the display. Attempting to set TopRow to a greater value will cause the control to set it to the largest possible value (no error will occur).

To ensure that a given cell is visible, use the ShowCell method instead.

Data Type

Long

See Also

VSFlexGrid Control