Spread ASP.NET 6.0 Product Documentation
GetValue Method
See Also  Example Send Feedback
FarPoint.CalcEngine Assembly > FarPoint.CalcEngine Namespace > CalcReference Class : GetValue Method


row
Row index
column
Column index

Glossary Item Box

Gets the value at the specified position in the cell or range reference.

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 CalcReference
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 creates a custom function.
C#Copy Code
public class Cube : FarPoint.CalcEngine.FunctionInfo 
	{ 

		public override string Name 
		{ 
			get 
			{ 
				return "Cube"; 
			} 
		} 

		public override int MaxArgs 
		{ 
			get 
			{ 
				return 1; 
			} 
		} 

		public override int MinArgs 
		{ 
			get 
			{ 
				return 1; 
			} 
		} 

		public override bool AcceptsReference(int i) 
		{ 
			if (i == 0) 
			{ 
				return true; 
			} 
			else 
			{ 
				return false; 
			} 
		} 

		public override object Evaluate(object[] args) 
	{ 
		double total; 
		FarPoint.CalcEngine.CalcReference cellref; 
		object value; 
		if (args[0] is FarPoint.CalcEngine.CalcArray) 
	{ 
		return FarPoint.CalcEngine.CalcError.Value; 
	} 
	if (args[0] is FarPoint.CalcEngine.CalcReference) 
{ 
	cellref = ((FarPoint.CalcEngine.CalcReference)(args[0])); 
	if (cellref.ColumnCount > 1 | cellref.RowCount > 1) 
{ 
	return FarPoint.CalcEngine.CalcError.Value; 
} 
	value = cellref.GetValue(cellref.Row, cellref.Column); 
	try 
{ 
	total = Math.Pow(FarPoint.CalcEngine.CalcConvert.ToDouble(args[0]), 3); 
} 
	catch 
{ 
} 
} 
	else 
{ 
	try 
{ 
	total = Math.Pow(FarPoint.CalcEngine.CalcConvert.ToDouble(args[0]), 3); 
} 
	catch 
{ 
} 
} 
	return total; 
} 
}
Visual BasicCopy Code
Public Class Cube 
Inherits FarPoint.CalcEngine.FunctionInfo 

Public Overrides ReadOnly Property Name() As String 
Get 
Return "Cube" 
End Get 
End Property 

Public Overrides ReadOnly Property MaxArgs() As Integer 
Get 
Return 1 
End Get 
End Property 

Public Overrides ReadOnly Property MinArgs() As Integer 
Get 
Return 1 
End Get 
End Property 

Public Overrides Function AcceptsReference(ByVal i As Integer) As Boolean 
If i = 0 Then 
Return True 
Else 
Return False 
End If 
End Function 

Public Overrides Function Evaluate(ByVal args() As Object) As Object 
Dim total As Double 
Dim cellref As FarPoint.CalcEngine.CalcReference 
Dim value As Object 
If TypeOf args(0) Is FarPoint.CalcEngine.CalcArray Then Return FarPoint.CalcEngine.CalcError.Value 
If TypeOf args(0) Is FarPoint.CalcEngine.CalcReference Then 
cellref = CType(args(0), FarPoint.CalcEngine.CalcReference) 
If cellref.ColumnCount > 1 Or cellref.RowCount > 1 Then Return FarPoint.CalcEngine.CalcError.Value 
value = cellref.GetValue(cellref.Row, cellref.Column) 
Try 
total = FarPoint.CalcEngine.CalcConvert.ToDouble(value) ^ 3 
Catch 
End Try 
Else 
Try 
total = FarPoint.CalcEngine.CalcConvert.ToDouble(args(0)) ^ 3 
Catch 
End Try 
End If 
Return total 
End Function 
End Class 

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.