《VB计算器源代码.pdf》由会员分享,可在线阅读,更多相关《VB计算器源代码.pdf(3页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、文档从互联网中收集,已重新修正排版,word 格式支持编辑,如有帮助欢迎下载支持。VB 计算器源代码Private Data As DoublePrivate lOperation As LongPrivate fClear As BooleanPrivate Sub Command1_Click(Index As Integer)If fClear = True Then Text1.Text = : fClear = FalseText1.Text = Text1.Text & IndexEnd SubPrivate Sub Command2_Click()If InStr(1, Text
2、1.Text, .) 0 Then Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)End SubPrivate Sub Command5_Click()If fClear = False ThenSelect Case lOperationCase 0Case 1: Text1.Text = Data + Val(Text1.Text)Case 2: Text1.Text = Data - Val(Text1.Text)Case 3: Text1.Text = Data * Val(Text1.Text)Case 4: If Val(Tex
3、t1.Text)= 0 Then MsgBox 除数不等于 0: Exit Sub Else Text1.Text= Data /Val(Text1.Text)End SelectEnd IfData = Val(Text1.Text)fClear = TruelOperation = 1End SubPrivate Sub Command6_Click()If fClear = False ThenSelect Case lOperationCase 0Case 1: Text1.Text = Data + Val(Text1.Text)Case 2: Text1.Text = Data -
4、 Val(Text1.Text)Case 3: Text1.Text = Data * Val(Text1.Text)Case 4: If Val(Text1.Text)= 0 Then MsgBox 除数不等于 0: Exit Sub Else Text1.Text= Data /Val(Text1.Text)End SelectEnd IfData = Val(Text1.Text)fClear = TruelOperation = 2End Sub2word 格式支持编辑,如有帮助欢迎下载支持。文档从互联网中收集,已重新修正排版,word 格式支持编辑,如有帮助欢迎下载支持。Privat
5、e Sub Command7_Click()If fClear = False ThenSelect Case lOperationCase 0Case 1: Text1.Text = Data + Val(Text1.Text)Case 2: Text1.Text = Data - Val(Text1.Text)Case 3: Text1.Text = Data * Val(Text1.Text)Case 4: If Val(Text1.Text)= 0 Then MsgBox 除数不等于 0: Exit Sub Else Text1.Text= Data /Val(Text1.Text)E
6、nd SelectEnd IfData = Val(Text1.Text)fClear = TruelOperation = 3End SubPrivate Sub Command8_Click()If fClear = False ThenSelect Case lOperationCase 0Case 1: Text1.Text = Data + Val(Text1.Text)Case 2: Text1.Text = Data - Val(Text1.Text)Case 3: Text1.Text = Data * Val(Text1.Text)Case 4: If Val(Text1.Text)= 0 Then MsgBox 除数不等于 0: Exit Sub Else Text1.Text= Data /Val(Text1.Text)End SelectEnd IfData = Val(Text1.Text)fClear = TruelOperation = 4End SubPrivate Sub Command9_Click()Text1.Text = lOperation = 0End Sub3word 格式支持编辑,如有帮助欢迎下载支持。