|
-
Jun 2nd, 2002, 01:52 PM
#1
Thread Starter
Junior Member
Completely confused
I need some help with an assignment. I know that there is a PMT function, but it is not working for me. I am trying to make a form in visual basic that will calculate the loan payment when given the principle, interest rate, and length of loan in years. Unfortunately, I do not get to design the interface. It has already been done for me. The user is required to type in hte loan amount, select the interest rate from a list box, and select the years the money is loaned from option boxes.
Here is the code I have written. It does not give the correct result and I am stumped. Can anyone tell me what is wrong with the code?
Dim dblPrinciple As Double, sngInterest As Single, sngMinterest As Single
Dim intLength As Integer, intMonths As Integer, dblPayment
Dim i As Integer
For i = 0 To 3
Select Case i
Case 0
intLength = Val(2)
Case 1
intLength = Val(3)
Case 2
intLength = Val(4)
Case 3
intLength = Val(5)
End Select
Next
dblPrinciple = Val(txtPrincipal.Text)
sngInterest = Val(lstInterest.Text)
sngMinterest = sngInterest / 12 * 100
intMonths = intLength * 12
dblPayment = dblPrinciple * (sngMinterest / (1 - (1 + sngMinterest) ^ -intMonths))
lblPayment.Caption = dblPayment
lblPayment.Caption = Format(lblPayment.Caption, "Currency")
-
Jun 2nd, 2002, 03:37 PM
#2
Thread Starter
Junior Member
Nevermind. I got it with the pmt function.
I was making a stupid mistake.
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
|