VB计算器源代码.doc

上传人:飞****2 文档编号:60125455 上传时间:2022-11-13 格式:DOC 页数:5 大小:33.50KB
返回 下载 相关 举报
VB计算器源代码.doc_第1页
第1页 / 共5页
VB计算器源代码.doc_第2页
第2页 / 共5页
点击查看更多>>
资源描述

《VB计算器源代码.doc》由会员分享,可在线阅读,更多相关《VB计算器源代码.doc(5页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、Dim sum As DoubleDim flag1 As IntegerDim flag2 As IntegerPublic wen As DoublePrivate Sub Command19_Click() Command24_Click Operator = Index NewEntry = TrueEnd SubPrivate Sub Command1_Click(Index As Integer)Select Case Index Case 0 wen = 0 Label1.Caption = Case 1 Text1.Text = Str(wen) Case 2 If Text1

2、.Text = Then wen = 0 Label1.Caption = Else wen = Val(Text1.Text) Label1.Caption = M End If Text1.Text = Case 3 wen = Val(Text1.Text) + wen Label1.Caption = M End SelectEnd SubPrivate Sub Command12_Click()If Text1.Text Then Text1.Text = Text1.Text * -1Else MsgBox 输入不能为空!, vbOKOnly, 警告 Text1.SetFocus

3、End IfEnd SubPrivate Sub Command16_Click()If InStr(Text1.Text, .) = 0 ThenText1.Text = Text1.Text & .ElseExit SubEnd IfEnd SubPrivate Sub Command21_Click()Text1.Text = Str(Sqr(Val(Text1.Text)End SubPrivate Sub Command22_Click()sum = Text1.Textflag1 = 5flag2 = 1End SubPrivate Sub Command23_Click()Tex

4、t1.Text = Str(Val(Text1.Text / 1)flag2 = 0End SubPrivate Sub Command24_Click()Select Case (flag1)Case 1Text1.Text = sum + Text1.TextCase 2Text1.Text = sum - Text1.TextCase 3Text1.Text = sum * Text1.TextCase 4If Text1.Text = 0 Thendf = MsgBox(除数不能为零!请重新输入., vbOKOnly + vbInformation, 警告)Text1.Text = T

5、ext1.SetFocusExit SubElseText1.Text = sum / Text1.TextEnd IfCase 5If Text1.Text = 0 Then df = MsgBox(余数不能为零!请重新输入., vbOKOnly + vbInformation, 警告) Text1.Text = Text1.SetFocusExit SubElseText1.Text = sum Mod Text1.TextEnd IfEnd Selectflag2 = 0End SubPrivate Sub Command25_Click()If Text1.Text ThenText1

6、.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)If Text1.Text = ThenText1.Text = 0End IfEnd IfEnd SubPrivate Sub Command26_Click()Text1.Text = 0End SubPrivate Sub Command27_Click()Text1.Text = 0End SubPrivate Sub Command5_Click(Index As Integer)If flag2 = 1 Then Text1.Text = Index flag2 = 0Else If Te

7、xt1.Text 0 Then Text1.Text = Text1.Text & Index Else Text1.Text = & Index End IfEnd IfEnd SubPrivate Sub Command6_Click() If Text1.Text Then sum = Text1.Text flag1 = 4 flag2 = 1Else MsgBox 输入不能为空!, vbOKOnly, 警告 Text1.SetFocusEnd IfEnd SubPrivate Sub Command7_Click()If Text1.Text Then sum = Text1.Tex

8、t flag1 = 3 flag2 = 1Else MsgBox 输入不能为空!, vbOKOnly, 警告 Text1.SetFocusEnd IfEnd SubPrivate Sub Command8_Click()If Text1.Text Then sum = Text1.Text flag1 = 2 flag2 = 1Else MsgBox 输入不能为空!, vbOKOnly, 警告 Text1.SetFocusEnd IfEnd SubPrivate Sub Command9_Click()If Text1.Text Then sum = Text1.Text flag1 = 1 flag2 = 1Else MsgBox 输入不能为空!, vbOKOnly, 警告 Text1.SetFocusEnd IfEnd Sub

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

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁