home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form LoanCalc
- Caption = "Loan Calculator"
- ClientHeight = 2310
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5550
- LinkTopic = "Form3"
- ScaleHeight = 2310
- ScaleWidth = 5550
- StartUpPosition = 3 'Windows Default
- Begin VB.CheckBox PayEarly
- Alignment = 1 'Right Justify
- Caption = "Check if early payments"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 240
- Left = 150
- TabIndex = 4
- Top = 1680
- Width = 2550
- End
- Begin VB.TextBox Duration
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 2505
- TabIndex = 3
- Text = "48"
- Top = 1180
- Width = 1035
- End
- Begin VB.TextBox IRate
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 2505
- TabIndex = 2
- Text = "14.5"
- Top = 665
- Width = 1035
- End
- Begin VB.TextBox Amount
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 2490
- TabIndex = 1
- Text = "25000"
- Top = 225
- Width = 1035
- End
- Begin VB.CommandButton ShowPayment
- Caption = "Show Payment"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 480
- Left = 3720
- TabIndex = 0
- Top = 1680
- Width = 1680
- End
- Begin VB.Label Label3
- Caption = "Duration (in months)"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 210
- Left = 150
- TabIndex = 7
- Top = 1200
- Width = 1980
- End
- Begin VB.Label Label2
- Caption = "Interest Rate"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 150
- TabIndex = 6
- Top = 720
- Width = 1650
- End
- Begin VB.Label Label1
- Caption = "Loan's amount"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 150
- TabIndex = 5
- Top = 255
- Width = 1800
- End
- Attribute VB_Name = "LoanCalc"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub ShowPayment_Click()
- Dim Payment As Single
- Dim LoanIRate As Single
- Dim LoanDuration As Integer
- Dim LoanAmount As Integer
- If IsNumeric(Amount.Text) Then
- LoanAmount = Amount.Text
- Else
- MsgBox "Please enter a valid amount"
- Exit Sub
- End If
- If IsNumeric(IRate.Text) Then
- LoanIRate = 0.01 * IRate.Text / 12
- Else
- MsgBox "Invalid interest rate, please re-enter"
- Exit Sub
- End If
- If IsNumeric(Duration.Text) Then
- LoanDuration = Duration.Text
- Else
- MsgBox "Please specify the loan's duration as a number of months"
- Exit Sub
- End If
- Payment = Pmt(LoanIRate, LoanDuration, -LoanAmount, 0, PayEarly.Value)
- MsgBox Format$(Payment, "#.00")
- End Sub
-