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:
Public Class Form1
Private Sub cmdCompute_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCompute.Clic k
Dim amount As Double
Dim begindate As Integer
Dim enddate As Integer
amount = CDbl(TxtInitial Amount.Text)
begindate = DateTimePickerF ormat.Short
enddate = DateTimePickerF ormat.Short
Label4.Text = ("You now have " & CDbl(amount * 1.01) & "")
End Sub
End Class
This works fine for 1 month, but I need to be able to determine the number of months between the begindate and the enddate, and then somehow use that figure 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.
Public Class Form1
Private Sub cmdCompute_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCompute.Clic k
Dim amount As Double
Dim begindate As Integer
Dim enddate As Integer
amount = CDbl(TxtInitial Amount.Text)
begindate = DateTimePickerF ormat.Short
enddate = DateTimePickerF ormat.Short
Label4.Text = ("You now have " & CDbl(amount * 1.01) & "")
End Sub
End Class
This works fine for 1 month, but I need to be able to determine the number of months between the begindate and the enddate, and then somehow use that figure 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.
Comment