TopRow Property

See Also42UXGK0              Example00XK9AH>Low

Applies To



Determines the uppermost row displayed in the grid.  Not available at design time.


[form.]grid.TopRow[ = numericexpression ]


You can use this property in code to programmatically read or set the visible top row of the grid.  Use the LeftColTESE3X property to determine the leftmost visible column in the grid.

When setting this property, the largest possible row number is the total number of rows minus the number of rows that can be visible in the grid.  Attempting to set TopRow to a greater row number will generate an error.

Data Type


See Also


Col, Row PropertiesL43H93

LeftCol PropertyTESE3X


Programmer's Guide:

Chapter 3, "Creating and Using Controls"

TopRow Property Example

The example changes the TopRow property with each click on the form.  To try this example, create a new project, add GRID.VBX using the Add File command on the File menu, and then draw a grid.  Copy the code into the Declarations section and press F5 to run the program.

Sub Form_Load ()

   ' Set columns and rows.

   Grid1.Cols = 6

   Grid1.Rows = 12

   ' Put numbers in row heads.

   Grid1.Col = 0

   For I = 1 To Grid1.Rows - 1

      Grid1.Row = I

      Grid1.Text = I

   Next I

End Sub


Sub Form_Click ()

   On Error GoTo TopRowError

   Grid1.TopRow = Grid1.TopRow + 1

   On Error GoTo 0

   Exit Sub



   Grid1.TopRow = 1

   Resume Next

End Sub