See Also Example
Applies To
Grid.
Description
Determines the uppermost row displayed in the grid. Not available at design time.
Usage
[form.]grid.TopRow[ = numericexpression ]
Remarks
You can use this property in code to programmatically read or set the visible top row of the grid. Use the LeftCol 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
Integer
Help:
Col, Row Properties
LeftCol Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
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
TopRowError:
Grid1.TopRow = 1
Resume Next
End Sub