放一個textbox叫Text2 一個button叫Command1
然後在textbox裡面輸入100就是存100 輸入-300就是取300
複製程式
Dim MONEY As Integer
Private Sub Command1_Click()
If Val(Text2) < 0 Then
If Val(Text2) < MONEY Then
MONEY = MONEY + Val(Text2)
MsgBox ("提款金額=" + Text2 + Chr(13) + "你餘款剩" & MONEY)
Else
MsgBox "想搶劫嗎?"
End If
Else
MONEY = MONEY + Val(Text2)
MsgBox ("存款金額=" + Text2 + Chr(13) + "你的存款有" & MONEY)
End If
a = MsgBox("繼續交易", 52, "123銀行")
If a = 6 Then
Text2 = ""
Else
End
End If
End Sub
Private Sub Form_Load()
MONEY = 1000
End Sub