Spread for ASP.NET 8.0 Product Documentation
Adding Formulas to Calculate Balances

Your checkbook register is now set up to look like a checkbook register; however, it does not balance the currency figures you enter in the register. This step sets up the formula for balancing the figures.

  1. Below the code you have already added, add the following code:
    C#
    Copy Code
    // Set formula for calculating balance.
    FpSpread1.Sheets[0].ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1;
    FpSpread1.Sheets[0].Cells[0, 7].Formula = "RC[-1]-RC[-2]";
    for (int i = 1; i < 99; i++)
    {
      FpSpread1.Sheets[0].Cells[i, 7].Formula = "R[-1]C-RC[-2]+RC[-1]";
    }
    
    VB
    Copy Code
    ' Set formula for calculating balance.
    FpSpread1.Sheets(0).ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1
    FpSpread1.Sheets(0).Cells(0, 7).Formula = "RC[-1]-RC[-2]"
    Dim i As Integer
    For i = 1 To 99
      FpSpread1.Sheets(0).Cells(i, 7).Formula = "R[-1]C-RC[-2]+RC[-1]"
    Next
    
  2. Save your project, then from the Debug menu choose Start to run your project.

Your ASP.NET page should look similar to the following picture. Type data into your checkbook register to test it and see how it operates. Click on the checkmark icon to save the changes or set the ClientAutoCalculation property for the control to True.

Completed Checkbook Register

Your checkbook register is complete! You have completed this tutorial.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback