作者a9547510.bbs@bbs.kimo.com.tw (007), 信區: sources
標題幫我看我錯在哪
時間Yahoo!奇摩大摩域 (Wed Sep 22 12:13:12 2004)
轉信站: GIBBS!news2.ncku!ctu-gate!news.nctu!news.ncu!news.csie.ncu!netnews.kimo
Origin: bbs.kimo.com.tw
以下是我的算利息的程式,請解釋我錯在哪裡,好嗎?
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
--
※ Origin: Yahoo!奇摩 大摩域 <telnet://bbs.kimo.com.tw>
◆ From: 61-217-90-90.dynamic.hinet.net