VB计算器源代码

上传人:笛音 文档编号:31202360 上传时间:2018-02-05 格式:DOCX 页数:3 大小:49.01KB
返回 下载 相关 举报
VB计算器源代码_第1页
第1页 / 共3页
VB计算器源代码_第2页
第2页 / 共3页
VB计算器源代码_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《VB计算器源代码》由会员分享,可在线阅读,更多相关《VB计算器源代码(3页珍藏版)》请在金锄头文库上搜索。

1、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, Text1.Text, .) 0 Then Text1.Text = Left(Text1

2、.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(Text1.Text) = 0 Then MsgBox 除数不等于 0: Exit Su

3、b 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 - Val(Text1.Text)Case 3: Text1.Text = D

4、ata * 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 SubPrivate Sub Command7_Click()If fClear = False ThenSelect Case lOperationCase 0Case 1: Text1.Text = Data +

5、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 = 3End SubPrivate Sub Command8_Click

6、()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 Sub

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号