Col, Row Properties
See Also Example1 Example2
Determine the active cell in a grid. Not available at design time.
[form.]grid.Col[ = column ]
[form.]grid.Row[ = row ]
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.
Cols, Rows Properties
SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties
Chapter 3, "Creating and Using Controls"
Col, Row Properties Example
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
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"