See Also Example1 Example2
Apply To
Grid.
Description
Determine the active cell in a grid. Not available at design time.
Usage
[form.]grid.Col[ = column ]
[form.]grid.Row[ = row ]
Remarks
Use these properties to specify a cell in a grid or to find out which row or column contains the active cell in a selected region. Columns and rows are numbered from zero, beginning at the top for rows and at the left for columns. Setting these properties at run time does not change which cells are selected. Use SelEndCol, SelStartCol, SelEndRow, SelStartRow properties to specify a selected region.
Note The Col, Row properties are not the same as the Cols, Rows properties.
Data Type
Integer
Help:
Clip Property
Cols, Rows Properties
SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties
Text Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
The example puts "Here" into the current cell, and then changes the active cell to the third cell in the third row and puts "There" into that cell. To try this example, use the Add File command on the File menu to add GRID.VBX to the project, and then draw a grid on a new form. To run the program, press F5 and then click the grid.
Sub Form_Load ()
Grid1.Rows = 8 ' Set rows and columns.
Grid1.Cols = 5
End Sub
Sub Grid1_Click ()
' Put text in current cell.
Grid1.Text = "Here"
' Put text in 3rd row, 3rd column.
Grid1.Col = 2
Grid1.Row = 2
Grid1.Text = "There"
End Sub