Gets the collection of cells. Not available at design-time.
object.Cells(rowIndex, cellIndex)
object.Rows(RowIndex).Cells(CellIndex)
object.Columns(ColIndex).Cells(RowIndex)
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.
The following example returns the contents of the third cell in row 2 of the datagrid. VB SCRIPT:'Return the contents of the specified cell CellContents = App.ActiveForm.Controls.GrdActiveJobs.Rows(1).Cells(2).Text
JSCRIPT://Return the contents of the specified cell var CellContents = App.ActiveForm.Controls.GrdActiveJobs.Rows(1).Cells(2).Text;
The following example loops through all the cells in the grid and returns the cell contents in a message box. VB SCRIPT:'Obtain maximum row count for the grid GridRowCount = App.ActiveForm.Controls.grdActiveJobs.Rowcount
'Loop through each cell for each row of the grid For GridRowIndex = 0 to GridRowCount -1
next |
ColCount property | RowCount property | ColIndex property | RowIndex property | Marker property | DataGrid control
© 2004-2021 looksoftware. All rights reserved.