PublicClass Cube
Inherits FarPoint.CalcEngine.FunctionInfo
PublicOverridesReadOnlyProperty Name() AsStringGetReturn"Cube"EndGetEnd PropertyPublicOverridesReadOnlyProperty MaxArgs() AsIntegerGetReturn 1
EndGetEnd PropertyPublicOverridesReadOnlyProperty MinArgs() AsIntegerGetReturn 1
EndGetEnd PropertyPublicOverridesFunction AcceptsReference(ByVal i AsInteger) AsBooleanIf i = 0 ThenReturnTrueElseReturnFalseEndIfEnd FunctionPublicOverridesFunction Evaluate(ByVal args() AsObject) AsObjectDim total AsDoubleDim cellref As FarPoint.CalcEngine.CalcReference
Dim value AsObjectIfTypeOf args(0) Is FarPoint.CalcEngine.CalcArray ThenReturn FarPoint.CalcEngine.CalcError.Value
IfTypeOf args(0) Is FarPoint.CalcEngine.CalcReference Then
cellref = CType(args(0), FarPoint.CalcEngine.CalcReference)
If cellref.ColumnCount > 1 Or cellref.RowCount > 1 ThenReturn FarPoint.CalcEngine.CalcError.Value
value = cellref.GetValue(cellref.Row, cellref.Column)
Try
total = FarPoint.CalcEngine.CalcConvert.ToDouble(value) ^ 3
CatchEndTryElseTry
total = FarPoint.CalcEngine.CalcConvert.ToDouble(args(0)) ^ 3
CatchEndTryEndIfReturn total
End FunctionEnd Class