Creating Loan Calculator in VB.NET
In this article you will learn how to calculate Loan Amount.
In this article you will learn how to calculate Loan Amount.
In this article I have used five Labels and four TextBox one CheckBox and two Buttons.
Labels
Label |
Caption |
Label1 |
Loan Amount |
Label2 |
Duration(Months) |
Label3 |
Interest Rate of Loan |
Label4 |
Early Payment |
Label5 |
Monthly Installement |
TextBoxes
TextBox |
Name |
Text |
TextBox1 |
txtAmount |
Blank |
TextBox2 |
txtDuration |
Blank |
TextBox3 |
txtRate |
Blank |
TextBox4 |
txtPayment |
Blank |
CheckBox
Select the Checkbox and in the property window set the CheckAlignProperty is MiddleLeft.
Buttons
Select the Button1 and set the property Name is btnShowPayment.
Select the Button2 and set the property Name is btnExit.
Here is the full code of the Loan Calculator :
Private Sub btnShowPayment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowPayment.Click
Dim Payment As Single
Dim payEarly As DueDate
If chkPayEarly.Checked Then
payEarly = DueDate.BegOfPeriod
Else
payEarly = DueDate.EndOfPeriod
End If
Payment = Pmt(0.01 * txtRate.Text / 12, txtDuration.Text, -txtAmount.Text, 0, payEarly)
txtPayment.Text = Payment.ToString("#.00")
End Sub
Output