Spread Windows Forms 6.0 Product Documentation
GetValue Method
See Also  Example Support Options
FarPoint.CalcEngine Assembly > FarPoint.CalcEngine Namespace > CalcArray Class : GetValue Method


row
Row index
column
Column index

Glossary Item Box

Gets the value at the specified position in the array.

Syntax

Visual Basic (Declaration) 
Public MustOverride Function GetValue( _
   ByVal row As Integer, _
   ByVal column As Integer _
) As Object
Visual Basic (Usage)Copy Code
Dim instance As CalcArray
Dim row As Integer
Dim column As Integer
Dim value As Object
 
value = instance.GetValue(row, column)
C# 
public abstract object GetValue( 
   int row,
   int column
)

Parameters

row
Row index
column
Column index

Return Value

Object containing the value

Example

This example returns the number of columns and rows in the array.
C#Copy Code
object[,] knownY = {{2.0, 3.0, 9.0, 1.0, 8.0, 7.0, 5.0}};
object[,] knownX = {{6.0, 5.0, 11.0, 7.0, 5.0, 4.0, 4.0}};
FarPoint.CalcEngine.ArrayExpression arg1 = new FarPoint.CalcEngine.ArrayExpression(knownY);
FarPoint.CalcEngine.ArrayExpression arg2 = new FarPoint.CalcEngine.ArrayExpression(knownX);
FarPoint.CalcEngine.Expression[] args = {arg1, arg2};
FarPoint.CalcEngine.Expression func = new FarPoint.CalcEngine.FunctionExpression(FarPoint.CalcEngine.FunctionInfo.SlopeFunction,args);
//Spread for Windows Forms
((FarPoint.Win.Spread.Model.IExpressionSupport)fpSpread1.ActiveSheet.Models.Data).SetExpression(0, 0, func);
FarPoint.CalcEngine.CalcArray ca = arg1.ArrayValue;
MessageBox.Show("The value in the cell is " + ca.GetValue(0, 0).ToString());
MessageBox.Show("The number of rows is " + ca.RowCount.ToString() + " and the number of columns is " + ca.ColumnCount.ToString());
//Spread for Web Forms
((FarPoint.Web.Spread.Model.IExpressionSupport)FpSpread1.Sheets[0].DataModel).SetExpression(0, 0, func);
FarPoint.CalcEngine.CalcArray ca = arg1.ArrayValue;
TextBox1.Text = "The value in the cell is " + ca.GetValue(0, 0).ToString();
TextBox2.Text = "The number of rows is " + ca.RowCount.ToString() + " and the number of columns is " + ca.ColumnCount.ToString();
Visual BasicCopy Code
Dim x As Object(,) = {{2.0, 3.0, 9.0, 1.0, 8.0, 7.0, 5.0}}
Dim y As Object(,) = {{6.0, 5.0, 11.0, 7.0, 5.0, 4.0, 4.0}}
Dim arg1 As New FarPoint.CalcEngine.ArrayExpression(x)
Dim arg2 As New FarPoint.CalcEngine.ArrayExpression(y)
Dim args() As FarPoint.CalcEngine.Expression = {arg1, arg2}
Dim func As New FarPoint.CalcEngine.FunctionExpression(FarPoint.CalcEngine.FunctionInfo.SlopeFunction, args)
'Spread for Windows Forms
CType(FpSpread1.ActiveSheet.Models.Data, FarPoint.Win.Spread.Model.IExpressionSupport).SetExpression(0, 0, func)
Dim ca As FarPoint.CalcEngine.CalcArray = arg1.ArrayValue
MessageBox.Show("The value in the cell is " & ca.GetValue(0, 0))
MessageBox.Show("The number of rows is " & ca.RowCount & " and the number of columns is " & ca.ColumnCount)
'Spread for Web Forms
CType(FpSpread1.Sheets(0).DataModel, FarPoint.Web.Spread.Model.IExpressionSupport).SetExpression(0, 0, func)
Dim ca As FarPoint.CalcEngine.CalcArray = arg1.ArrayValue
TextBox1.Text = "The value in the cell is " & ca.GetValue(0, 0)
TextBox2.Text = "The number of rows is " & ca.RowCount & " and the number of columns is " & ca.ColumnCount

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.