loancalc.frm
来自「kauskdfgasb kjasyhgd jkashfg jkasuyhgdf 」· FRM 代码 · 共 252 行
FRM
252 行
VERSION 5.00
Begin VB.Form LoanCalc
BackColor = &H00C0C000&
Caption = "Loan Calculator"
ClientHeight = 5025
ClientLeft = 60
ClientTop = 345
ClientWidth = 7965
LinkTopic = "Form3"
ScaleHeight = 5025
ScaleWidth = 7965
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton bttnExit
Caption = "E X I T"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3000
TabIndex = 9
Top = 4440
Width = 1380
End
Begin VB.TextBox txtPmt
BackColor = &H00FFFFFF&
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 = 3825
Locked = -1 'True
TabIndex = 8
Top = 3585
Width = 1035
End
Begin VB.CheckBox PayEarly
Alignment = 1 'Right Justify
BackColor = &H00E0E0E0&
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 = 1470
TabIndex = 4
Top = 3120
Width = 2550
End
Begin VB.TextBox Duration
BackColor = &H00FFFFFF&
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 = 3825
TabIndex = 3
Text = "48"
Top = 2625
Width = 1035
End
Begin VB.TextBox IRate
BackColor = &H00FFFFFF&
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 = 3825
TabIndex = 2
Text = "14.5"
Top = 2100
Width = 1035
End
Begin VB.TextBox Amount
BackColor = &H00FFFFFF&
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 = 3810
TabIndex = 1
Text = "25000"
Top = 1665
Width = 1035
End
Begin VB.CommandButton ShowPayment
Caption = "Show Monthly 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 = 540
Left = 1545
TabIndex = 0
Top = 3555
Width = 2010
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H00E0E0E0&
Caption = "LOAN CALCULATOR"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 10
Top = 600
Width = 4815
End
Begin VB.Label Label3
BackColor = &H00E0E0E0&
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 = 1470
TabIndex = 7
Top = 2640
Width = 1980
End
Begin VB.Label Label2
BackColor = &H00E0E0E0&
Caption = "Annual 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 = 1470
TabIndex = 6
Top = 2160
Width = 2010
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "Loan 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 = 1470
TabIndex = 5
Top = 1695
Width = 2025
End
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 bttnExit_Click()
End
End Sub
Private Sub ShowPayment_Click()
Dim Payment As Single
Dim LoanIRate As Single
Dim LoanDuration As Integer
Dim LoanAmount As Single
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)
txtPmt.Text = Format(Payment, "currency")
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?