|
-
Apr 8th, 2005, 11:07 AM
#1
Thread Starter
Lively Member
Interest Calculator Help
I'm making an Interest Calculator for a comp prog class and I have everything done except a monthly Interest Rate. I need to display how much you would pay a month for x amount of years and x interest for x amount of dollars. My problem is my variable for monthly interest rate has a value of zero, which messes up all my monthly total payment.
Here is my code...
Private Sub chkMonthly_Click()
'Sends Monthly Payments to lstMonthlyPayments
intCounter = 1
curPrincipal = Val(txtAmount)
lstMonthlyDisplay.AddItem ("Month" & vbTab & "Amount Payed")
dblMthInterestRate = Val(txtInterest / (12 * 100))
intMonths = (intYears * 12)
curMonthlyPayment = curPrincipal * (dblMthInterestRate / (1 - (1 + dblMthInterestRate) ^ -intMonths))
txtMonthlyPayment = Format(curMonthlyPayment, "$######.00")
txtTotalInterest = (dblMthInterestRate * intMonths)
dblMthInterestRate = Format(dblMthInterestRate, "$######.00")
For intCounter = 1 To (intYears * 12)
curTotalPayment = (curTotalPayment + curMonthlyPayment)
curTotalPayment = curTotalPayment + dblMthInterestRate
lstMonthlyDisplay.AddItem (intCounter & vbTab & Format(curTotalPayment, "$######.00"))
Next intCounter
The variable in red is the variable that has no value.
CAN ANYONE HELP.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|