Spread Windows Forms 7.0 Product Documentation
AutoCalculation Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class : AutoCalculation Property


Glossary Item Box

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

Syntax

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

Property Value

Boolean: true to automatically recalculate formulas; false otherwise

Remarks

When this property is set to true, the Spread component automatically recalculates each formula when the contents of cells referenced by the formula change. When this property is set to false, cells with formulas are not updated when data changes.

If you have set this property to false, you can use the Recalculate method to force a recalculation of the formulas that have changed or the RecalculateAll method to force a recalculation of all formulas.

Define formulas using the Cell.Formula property, Row.Formula property, or Column.Formula property.

For more information about formulas, refer to the Formula Reference.

Example

This example sets whether the spreadsheet recalculates each formula when the contents of dependent cells change.
C#Copy Code
DialogResult dlg;
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)
{
    fpSpread1.ActiveSheet.AutoCalculation = true;
    fpSpread1.ActiveSheet.SetValue(0, 1, 50);
}
else if(dlg == DialogResult.No)
{
    fpSpread1.ActiveSheet.AutoCalculation = false;
    fpSpread1.ActiveSheet.SetValue(0, 1, 50);
}
Visual BasicCopy Code
Dim dlg As DialogResult
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 Then
    FpSpread1.ActiveSheet.AutoCalculation = True
    FpSpread1.ActiveSheet.SetValue(0, 1, 50)
ElseIf dlg = DialogResult.No Then
    FpSpread1.ActiveSheet.AutoCalculation = False
    FpSpread1.ActiveSheet.SetValue(0, 1, 50)
End If

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

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