Spread Windows Forms 6.0 Product Documentation
AutoCalculation Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Model Namespace > ICalculationSupport Interface : AutoCalculation Property


Glossary Item Box

Gets or sets whether the control automatically recalculates each formula in the sheet when the contents of dependent cells change.

Syntax

Visual Basic (Declaration) 
Property AutoCalculation As Boolean
Visual Basic (Usage)Copy Code
Dim instance As ICalculationSupport
Dim value As Boolean
 
instance.AutoCalculation = value
 
value = instance.AutoCalculation
C# 
bool AutoCalculation {get; set;}

Property Value

Boolean: true to automatically recalculate formulas; false otherwise

Example

This example sets whether the spreadsheet recalculates each formula when the contents of dependent cells change.
C#Copy Code
DialogResult dlg;
FarPoint.Win.Spread.Model.ICalculationSupport cs;
fpSpread1.ActiveSheet.SetValue(0, 0, 10);
fpSpread1.ActiveSheet.SetValue(0, 1, 20);
fpSpread1.ActiveSheet.SetFormula(3, 0, "SUM(A1,B1)");
dlg = MessageBox.Show("Do you want to recalculate the formula?", "AutoCalculation", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
     cs = (FarPoint.Win.Spread.Model.ICalculationSupport)fpSpread1.ActiveSheet.Models.Data;
     cs.AutoCalculation = true;
     fpSpread1.ActiveSheet.SetValue(0, 1, 50);
}
else if(dlg == DialogResult.No)
{
     cs = (FarPoint.Win.Spread.Model.ICalculationSupport)fpSpread1.ActiveSheet.Models.Data;
     cs.AutoCalculation = false;
     fpSpread1.ActiveSheet.SetValue(0, 1, 50);
}
Visual BasicCopy Code
Dim dlg As DialogResult
Dim cs As FarPoint.Win.Spread.Model.ICalculationSupport
FpSpread1.ActiveSheet.SetValue(0, 0, 10)
FpSpread1.ActiveSheet.SetValue(0, 1, 20)
FpSpread1.ActiveSheet.SetFormula(3, 0, "SUM(A1,B1)")
dlg = MessageBox.Show("Do you want to auto calc the formula?", "AutoCalculation", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
     cs = FpSpread1.ActiveSheet.Models.Data
     cs.AutoCalculation = True
     FpSpread1.ActiveSheet.SetValue(0, 1, 50)
ElseIf dlg = DialogResult.No Then
     cs = FpSpread1.ActiveSheet.Models.Data
     cs.AutoCalculation = False
     FpSpread1.ActiveSheet.SetValue(0, 1, 50)
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.