Library tutorials & articles
Mathematical Functions
Compound Interest
Here is a little function that calulates the compound interest of an amount, over the specified period.
Function CompoundInterest(cStartAmount As Currency, fInterestPerPeriod
As Single, lPeriods As Long) As Currency
Dim i As Long
Dim cTotal As Currency
cTotal = cStartAmount
For i = 1 To lPeriods
cTotal = cTotal + (cTotal * (fInterestPerPeriod))
Next i
CompoundInterest = cTotal - cStartAmount
End Function
Private Sub cmdCalculate_Click()
'// 100 = starting amount
'// 0.1 = 10% Interest per period
'// 2 = 2 periods
MsgBox CompoundInterest(100, 0.1, 2)
End Sub
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Comments
Leave a comment
Sign in or Join us (it's free).