[RESOLVED] calculating interest
I am working on a program in which the user enters an amount of money in a textbox, selects a beginning and ending date using the datetimepicker, and then the program calculates the new amount based on an interest rate of 1% compounded monthly. The code I have written is as follows:
VB Code:
Public Class Form1
Private Sub cmdCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCompute.Click
Dim startdate
Dim enddate
Dim lngMonths As Long
Dim amount As Double
amount = txtInitialAmount.Text
startdate = DateStart.Value.ToShortDateString
enddate = DateEnd.Value.ToShortDateString
lngMonths = DateDiff("m", startdate, enddate)
lblResult.Text = amount * 1.01 * lngMonths
End Sub
End Class
Tthe number of months between the startdate and the enddate is given in lngMonths, but I need to somehow use that figure from lngMonths in the formula so that if, for example, the user selects 3 months the formula will be amount * 1.01*1.01*1.01.
I know what I need to do, but don't seem to be able to get there!! Any guidance would be appreciated.
Re: [RESOLVED] calculating interest
Look at the code here. Leave out the Option Compare Database.