Spread Windows Forms 6.0 Product Documentation
DoubleExpression Constructor
See Also  Example Support Options
FarPoint.CalcEngine Assembly > FarPoint.CalcEngine Namespace > DoubleExpression Class : DoubleExpression Constructor


value
Double value

Glossary Item Box

Creates a new expression with a double constant value.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal value As Double _
)
Visual Basic (Usage)Copy Code
Dim value As Double
 
Dim instance As New DoubleExpression(value)
C# 
public DoubleExpression( 
   double value
)

Parameters

value
Double value

Example

This example creates a custom name using a DoubleExpression.
C#Copy Code
//Spread for Windows Forms
FarPoint.CalcEngine.DoubleExpression de = new FarPoint.CalcEngine.DoubleExpression(55.0);
fpSpread1.ActiveSheet.AddCustomName("Alpha", de);
fpSpread1.ActiveSheet.SetFormula(0, 0, "Alpha * 10");
FarPoint.CalcEngine.Expression expr = fpSpread1.ActiveSheet.GetCustomName("Alpha"); 
if (expr is FarPoint.CalcEngine.DoubleExpression) 
{ 
FarPoint.CalcEngine.DoubleExpression ex = ((FarPoint.CalcEngine.DoubleExpression)(expr)); 
MessageBox.Show("The double value is " + ex.DoubleValue.ToString()); 
}
//Spread for Web Forms
FarPoint.CalcEngine.DoubleExpression de = new FarPoint.CalcEngine.DoubleExpression(55.0);
FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = new FarPoint.Web.Spread.Model.DefaultSheetDataModel();  
dataModel = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
dataModel.AddCustomName("Alpha", de);
FpSpread1.Sheets[0].SetFormula(0, 0, "Alpha * 10");
FarPoint.CalcEngine.Expression expr = dataModel.GetCustomName("Alpha"); 
if (expr is FarPoint.CalcEngine.DoubleExpression) 
{ 
FarPoint.CalcEngine.DoubleExpression ex = ((FarPoint.CalcEngine.DoubleExpression)(expr)); 
TextBox1.Text = "The double value is " + ex.DoubleValue.ToString(); 
}
Visual BasicCopy Code
'Spread for Windows Forms
Dim de As New FarPoint.CalcEngine.DoubleExpression(55.0)
FpSpread1.ActiveSheet.AddCustomName("Alpha", de)
FpSpread1.ActiveSheet.SetFormula(0, 0, "Alpha * 10")
Dim expr As FarPoint.CalcEngine.Expression = FpSpread1.ActiveSheet.GetCustomName("Alpha")
If TypeOf expr Is FarPoint.CalcEngine.DoubleExpression Then
Dim ex As FarPoint.CalcEngine.DoubleExpression = CType(expr, FarPoint.CalcEngine.DoubleExpression)
MessageBox.Show("The double value is " & ex.DoubleValue.ToString())
End If
'Spread for Web Forms
Dim de As New FarPoint.CalcEngine.DoubleExpression(55.0)
Dim dataModel As New FarPoint.Web.Spread.Model.DefaultSheetDataModel
dataModel = FpSpread1.ActiveSheetView.DataModel
dataModel.AddCustomName("Alpha", de)
FpSpread1.Sheets(0).SetFormula(0, 0, "Alpha * 10")
Dim expr As FarPoint.CalcEngine.Expression = dataModel.GetCustomName("Alpha")
If TypeOf expr Is FarPoint.CalcEngine.DoubleExpression Then
Dim ex As FarPoint.CalcEngine.DoubleExpression = CType(expr, FarPoint.CalcEngine.DoubleExpression)
TextBox1.Text = "The double value is " & ex.DoubleValue.ToString()
End If

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.