Spread for ASP.NET 10 Product Documentation > Developer's Guide > Getting Started > Tutorial: Creating a Checkbook Register > 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.
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 |
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.
Your checkbook register is complete! You have completed this tutorial.