Private Sub btnend_Click()
End
End Sub
Private Sub txtcapital_KeyPress(KeyAscii As Integer) '只能輸入數字
If KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 9 And KeyAscii <> 27
Then
Select Case Chr(KeyAscii)
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Case Else
KeyAscii = 0
End Select
End If
End Sub
Private Sub txtinterest_Change()
txtinterest.Text = ""
MsgBox "別玩了,這裡不能輸入", 16
End Sub
Private Sub txtrate_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 9 And KeyAscii <> 27
Then
Select Case Chr(KeyAscii)
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Case Else
KeyAscii = 0
End Select
End If
If txtrate.Text < 0 Or txtrate.Text > 100 Then
MsgBox "年利率輸入錯誤", 16
txtrate.Text = ""
End If
End Sub
Private Sub txtyear_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 9 And KeyAscii <> 27
Then
Select Case Chr(KeyAscii)
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Case Else
KeyAscii = 0
End Select
End If
End Sub
Private Sub btnrun_Click()
If txtcapital.Text = "" Then '沒褕入
MsgBox "請輸入本金", 0 + 16, "Error"
End If
If txtrate.Text = "" Then
MsgBox "請輸入年利率", 0 + 16, "Error"
End If
If txtyear.Text = "" Then
MsgBox "請輸入年數", 0 + 16, "Error"
End If
'本金是txtcapital
'利率是txtrate
'年數是txtyear
If txtcapital.Text <> "" & txtrate.Text <> "" & txtyear.Text <> "" Then
txtinterest.Text = txtcapital.Text * ((1 + (txtrate.Text / 100)) ^ txtyear.Text
)
End If
End Sub
Private Sub Command1_Click() '重新計算
txtcapital.Text = ""
txtrate.Text = ""
txtyear.Text = ""
txtinterest = ""
End Sub
--
[0m [1;33m※ Origin: [36mYahoo!奇摩 大摩域 [37m<telnet://bbs.kimo.com.tw> [m
[1;35m◆ From: [1;32m61-217-89-6.dynamic.hinet.net [m