Cells Property

Gets the collection of cells. Not available at design-time.

object.Cells(rowIndex, cellIndex)

object.Rows(RowIndex).Cells(CellIndex)

object.Columns(ColIndex).Cells(RowIndex)

Use

The contents of the Grid control are represented as an array of cells.

A Grid Control has a specific number of rows however the number of columns in a Grid may vary from row to row.

Any given cell can be referenced using any of the above syntax. The first two use the Cell Index within the specified row to reference the cell. In some grids the total number of cells may vary from row to row therefore the same Cell Index on any two rows does not necessarily mean that these two cells are in the same column. When you need to ensure that the returned cell is within the specified column use the columns(ColIndex).Cells syntax. Use the ColCount(n) property, where n is the row index, to determine the total number of columns for the specified row.

With grids bound to a data source, the number of cells in each row is usually consistent with the no. of columns, so in these cases, a column index and a cell index are the same thing.

The Rows, Columns and Cells collection have zero-based indexes therefore the first cell in a grid has a row index of 0, and a cell index of 0.

To set or return the text from a particular cell in a script you must explicitly specify the Text property. See the example below.

See Also

ColCount property | RowCount property | ColIndex property | RowIndex property | Marker property | DataGrid control

Applies To

Column Object

DataGrid control


© 2004-2021 looksoftware. All rights reserved.