The legal tricks-Learn Your Self

Latest gadgets,softwares,hardware,reviews,programming and campuses, game cheats ext......

Sample VB Programs-Length of Payment Period Calculator

Currently people seem to face a lot of difficulties to secure a loan or have problem to pay back a loan. The subprime loan issues seem to hit everyone hard. Still, we need to borrow money every now and then to acquire an asset or to pay for education fees. So, naturally we need to find out how long we can settle a loan for a certain amount of monthly payment at a certain interest rate. It is not easy to calculate such figure, fortunately VB come to the rescue. There is built-in function in VB to calculate the payment period is Nper and the format is

The Format of loan payback period is

Nper(Rate,Pmt,Pv,Fv,Due)

Rate=Interest Rate

Pmt=Amount of Periodic Payment

PV=Loan taken

FV=Future Value (set to 0 if load is settled)

Due=set to 1 if payment at the begining of the period

set to 0 if payment at the end of the period
Image

Code:
Private Sub Command1_Click()
Dim payment, Loan, Int_Rate As Double
Dim Num_year As Single

payment = Val(Txt_Payment.Text)

Int_Rate = (Val(Txt_Rate.Text) / 100) / 12
Loan = Val(Txt_PV.Text)

Num_year = NPer(Int_Rate, payment, -Loan, 0, 0) / 12

Lbl_Period.Caption = Str(Int(Num_year))
End Sub

0 comments: