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.
Provide the following code in the FpSpread class LeaveCell event:
Example
C# | Copy Code |
---|---|
// Set formula for calculating balance. fpSpread1.Sheets[0].ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1; int i; for (i = 0; i <= fpSpread1.ActiveSheet.RowCount - 1; i++) { if (i == 0) fpSpread1.Sheets[0].Cells[i, 7].Formula = "RC[-1] - RC[-2]" ; else fpSpread1.Sheets[0].Cells[i, 7].Formula = "RC[-1] - RC[-2] + R[-1]C"; } |
VB | Copy Code |
---|---|
' Set formula for calculating balance. FpSpread1.Sheets(0).ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1 Dim i As Integer For i = 0 To FpSpread1.ActiveSheet.RowCount - 1 If i = 0 Then FpSpread1.Sheets(0).Cells(i, 7).Formula = "RC[-1] - RC[-2]" Else FpSpread1.Sheets(0).Cells(i, 7).Formula = "RC[-1]-RC[-2]+R[-1]C" End If Next |
Save your project, then from the Debug menu choose Start to run your project.
Your form should look similar to the following picture. Type data into your checkbook register to test it and see how it operates.
You have created a checkbook register using Spread. You have completed this tutorial.
Review the list of steps for Tutorial: Creating a Checkbook Register.