vb期末实验作业---自动存取款机程序编写.doc_第1页
vb期末实验作业---自动存取款机程序编写.doc_第2页
vb期末实验作业---自动存取款机程序编写.doc_第3页
vb期末实验作业---自动存取款机程序编写.doc_第4页
vb期末实验作业---自动存取款机程序编写.doc_第5页
已阅读5页,还剩4页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Form1(登录界面)Dim t%Private Sub Command1_Click()Static n As IntegerDim i%Open c:account.dat For Random As #1 Len = Len(s)For i = 1 To LOF(1) / Len(s)Get #1, i, sIf Trim(Text1) = Trim(s.account) And Trim(Text2) = Trim(s.password) ThenForm1.HideForm2.ShowTimer2.Enabled = FalseElseMsgBox 密码或账号错误,错误三次该账号不能使用, 0, 注意n = n + 1If n = 3 Then MsgBox 密码错误三次,账号停用, 0, 提示: EndEnd IfExit ForNext iClose #1t = 60Text1 = Text2 = End SubPrivate Sub Command2_Click()Text1 = Text2 = End SubPrivate Sub Form_Load()t = 60End SubPrivate Sub Timer1_Timer()RandomizeLabel3.ForeColor = RGB(Int(Rnd * 256 + 0), Int(Rnd * 256 + 0), Int(Rnd * 256 + 0)End SubPrivate Sub Timer2_Timer()t = t - 1Label4.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUText1 = Text2 = t = 180Form1.HideForm8.ShowTimer2.Enabled = FalseEnd IfEnd SubForm2(操作界面)Dim t%Private Sub Command1_Click()Form2.HideForm3.Showt = 180Timer1.Enabled = FalseForm3.Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Form2.HideForm4.Showt = 180Timer1.Enabled = FalseForm4.Timer1.Enabled = TrueEnd SubPrivate Sub Command3_Click()Form2.HideForm5.Showt = 180Timer1.Enabled = FalseForm5.Timer1.Enabled = TrueEnd SubPrivate Sub Command4_Click()Form2.HideForm6.Showt = 180Timer1.Enabled = FalseForm6.Timer1.Enabled = TrueEnd SubPrivate Sub Command5_Click()Form2.HideForm7.Showt = 180Timer1.Enabled = FalseForm7.Timer1.Enabled = TrueEnd SubPrivate Sub Command6_Click()MsgBox 是否打印凭条, 1, 提示 Form2.Hide Form9.Showt = 180Timer1.Enabled = FalseForm1.Timer2.Enabled = TrueEnd SubPrivate Sub Form_Load()t = 180End SubPrivate Sub Timer1_Timer()t = t - 1Label2.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm3(取钱)Private Sub Command1_Click()Text1 = Text1 = 100End SubPrivate Sub Command2_Click()Text1 = Text1 = 500End SubPrivate Sub Command3_Click()Text1 = Text1 = 1000End SubPrivate Sub Command4_Click()If Val(Text1) s.money ThenMsgBox 余额不足, 0, 提示ElseOpen c:account.dat For Random As #1 Len = Len(s)s.money = s.money - Val(Text1)Close #1End IfText1 = MsgBox 取款成功, 0, 提示End SubPrivate Sub Command5_Click()Text1 = Text1 = 1500End SubPrivate Sub Command6_Click()Text1 = Text1 = 2000End SubPrivate Sub Command7_Click()Form3.HideForm2.Showt = 60Form2.Timer1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Command8_Click()Text1 = End SubPrivate Sub Form_Load()t = 60End SubPrivate Sub Timer1_Timer()t = t - 1Label2.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm4(存款)Dim t%Private Sub Command1_Click()Text1 = End SubPrivate Sub Command2_Click()Form4.HideForm2.Showt = 60Form2.Timer1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Command3_Click()Open c:account.dat For Random As #1 Len = Len(s)s.money = s.money + Val(Text1)Close #1Text1 = MsgBox 存款成功, 0, 提示End SubPrivate Sub Form_Load()t = 60End SubPrivate Sub Timer1_Timer()t = t - 1Label2.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm5(转账)Dim t%Private Sub Command1_Click()Text1 = End SubPrivate Sub Command2_Click()If Val(Text1) = Val(Text3) ThenIf Val(Text2) s.money ThenMsgBox 余额不足, 0, 提示ElseOpen c:account.dat For Random As #1 Len = Len(s)s.money = s.money - Val(Text2)Close #1End IfText1 = Text2 = Text3 = MsgBox 转账成功, 0, 提示ElseText1 = Text3 = MsgBox 账号输入不相同, 0, 提示End IfEnd SubPrivate Sub Command3_Click()Form5.HideForm2.Showt = 180Form2.Timer1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Command4_Click()Text1 = Text3 = End SubPrivate Sub Form_Load()t = 180End SubPrivate Sub Text1_Change()End SubPrivate Sub Timer1_Timer()t = t - 1Label4.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm6(改密)Dim t%Private Sub Command1_Click()Text1 = Text2 = End SubPrivate Sub Command2_Click()If Val(Text1) = Val(Text2) ThenOpen c:account.dat For Random As #1 Len = Len(s)s.password = Val(Text1.Text)Close #1MsgBox 密码已修改, 0, 提示ElseMsgBox 两次输入的密码不相同,请重新输入, 0, 提示Text1 = Text2 = End IfEnd SubPrivate Sub Command3_Click()Form6.HideForm2.Showt = 120Form2.Timer1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Form_Load()t = 120End SubPrivate Sub Text1_Change()End SubPrivate Sub Timer1_Timer()t = t - 1Label3.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm7(用户信息)Dim t%Private Sub Command1_Click()Form7.HideForm2.Showt = 60Form2.Timer1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Command2_Click()ClsPrintPrintPrint Space(15); 账户: & s.accountPrint Space(15); 余额: & s.moneyPrint Space(15); 密码: & s.passwordEnd SubPrivate Sub Form_Load()t = 60End SubPrivate Sub Timer1_Timer()t = t - 1Label2.Caption = 剩余时间: & t & 秒If t = 0 ThenMsgBox 操作超时, 0, Bank of SWUForm2.HideForm1.ShowEnd IfEnd SubForm8(进入)Private Sub Command1_Click()Form8.HideForm1.ShowOpen c:account.dat For Random As #1 Len = Len(s)s.account = 1s.password = 1s.money = 10000000Put

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论