See Also Example
Applies To
Grid.
Description
Determines the leftmost visible column (other than a fixed column) in the grid. Not available at design time.
Usage
[form.]grid.LeftCol[ = numericexpression ]
Remarks
You can use this property in code to scroll a grid programmatically. Use the TopRow property to determine the topmost visible row in the grid.
Data Type
Integer
Help:
Col, Row Properties
TopRow Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
The example changes the LeftCol property with each click of 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 ()
Grid1.Rows = 8 ' Set columns and rows.
Grid1.Cols = 9
Grid1.Row = 0
For I = 1 To Grid1.Cols - 1 ' Set numbers in column heads.
Grid1.Col = I
Grid1.Text = I
Next I
End Sub
Sub Form_Click ()
On Error GoTo LeftColError
' Scroll the grid by one column.
Grid1.LeftCol = Grid1.LeftCol + 1
On Error GoTo 0
Exit Sub
LeftColError:
Grid1.LeftCol = 1 ' Display the first column.
Resume Next
End Sub