平安车主卡 保险 没用:runtime error '424' object required?

来源:百度文库 编辑:高考问答 时间:2024/05/03 19:42:36
Private Sub cmdCalculate_Click()
Dim cPrincipal As Currency
Dim fIntRate As Single
Dim nTerm As Integer, cPayment As Currency

'Store the principal in the variable cPrincipal
cPrincipal = Val(txtPrincipal.Text)

'Convert interest rate to its decimal equivalent
' i.e. 12.75 becomes 0.125
fIntRate = Val(txtIntRate) / 100

'Convert annual interest rate to monthly
fIntRate = fIntRate / 12

'Convert number of years to number of months
' by multiplying by 12 (months in a year)
nTerm = Val(txtTerm.Text) * 12

'calculate and display the monthly payment.
' The format function makes the displayed number look good
cPayment = cPrincipal * (fIntRate / (1 - (1 + fIntRate) ^ -nTerm))
txtPayment.Text = Format(cPayment, "Fixed")

End Sub

debug的时候,提示 nTerm = Val(txtTerm.Text) * 12