Spread Windows Forms 11.0 Product Documentation
AutoCalculation Property (SheetView)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class : AutoCalculation Property
Gets or sets whether the control recalculates each formula when the contents of dependent cells change for a sheet.
Syntax
'Declaration
 
Public Property AutoCalculation As Boolean
'Usage
 
Dim instance As SheetView
Dim value As Boolean
 
instance.AutoCalculation = value
 
value = instance.AutoCalculation
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.
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);
}
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
See Also

Reference

SheetView Class
SheetView Members

User-Task Documentation

Managing Formulas in Cells