Help Center

TextMatrixfunction

Returns or sets the text contents of an arbitrary cell.

Windowsfunctiondoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

FUNCTION TextMatrix (BYVAL nRow AS LONG, BYVAL nCol AS LONG) AS DWSTRING
FUNCTION TextMatrix (BYVAL nRow AS LONG, BYVAL nCol AS LONG, BYREF wszText AS WSTRING) AS HRESULT

Parameters

NameDescription
nRowThe zero-based index of the row.
nColThe zero-based index of the column.
wszTextThe text to set.

Description

Returns or sets the text contents of an arbitrary cell.

Remarks

Unlike the Text property, which only interacts with the active cell (defined by the Row and Col properties), TextMatrix allows you to target any cell directly using coordinates.

It is significantly faster than using Row, Col, and then Text because it avoids the overhead of moving the user's focus and redrawing the selection highlight.

You can update data in the background without affecting what the user has currently highlighted.

It works for all cells, including fixed (header) rows and columns, making it the standard tool for setting column headers at runtime.

Examples

' To set a cell value: grid.TextMatrix(row, col, string)

' To retrieve a cell value: variable = grid.TextMatrix(row, col)

' Setting a header label in the first fixed row grid.TextMatrix(0, 1) = "Customer Name"

' Setting data in a specific data row grid.TextMatrix(1, 1) = "John Smith"

' Retrieving data for a calculation Dim price As Double price = Val(grid.TextMatrix(5, 2))

Reference