Col, Row Properties

See AlsoG1ABSP              Example1O4OXKO>Low               Example2MEPHR0>Low

Apply To



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, SelStartRow1Q7SBUK properties to specify a selected region.


Note   The Col, Row properties are not the same as the Cols, Rows1WFQF0 properties.


Data Type


See Also


Clip Property1GRK6IK

Cols, Rows Properties1WFQF0

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties1Q7SBUK

Text Property14TWSRU


Programmer's Guide:

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

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