GridData.SetCell operator

Introduced

v4.0

Description

Changes the value of a single element inside the GridData object. The coordinates must be within the valid range of the GridData's dimensions.

When the rows and columns have label strings it is possible to specify the labels rather than indices. This is a slightly slower approach but it makes the code easier to read.

C# Syntax

GridData.SetCell( Object in_Column, Object in_Row, Object in_CellValue );

Scripting Syntax

GridData.SetCell( ColumnIndex, RowIndex, [CellValue] );

Parameters

Parameter Type Description
ColumnIndex long or string Index or label of the Column. The left-most column has index 0.
RowIndex long or string Index or label of the Row. The top row has index 0.
CellValue VARIANT New value for the cell

Examples

JScript Example

//Demonstrate setting data with the GridData.Data method
var oGridData = XSIFactory.CreateGridData();
oGridData.RowCount = 1 ;
oGridData.ColumnCount = 4 ;
oGridData.SetCell( 0, 0, "Column0,Row0" ) ;
oGridData.SetCell( 1, 0, "Column1,Row0" ) ;
try
{
	oGridData.SetCell( 9, 10, "Invalid Coordinates" ) ;
}
catch( e )
{
	Logmessage( "Invalid range specified" ) ;
}

See Also

GridData.GetCell GridData.Data