资源描述:
《vb计算器(界面设计+全部代码)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实用标准文案VB计算器此计算器能够实现加减乘除等一系列的功能。还有实现显示系统时间的附加功能。截图如下:程序设计:0-9和点在command1的组内。其他的按钮式运算符和其他功能。正切和余切有对特殊值进行警告,除也有对除数为零的情况提示警告,还有阶乘等一系列计算溢出的情况提出警告,还有很多需要完善。。。这仅供参考。PublicsumAsDoublePublickAsStringPublicdianAsBooleanPublicbAsIntegerPublicpointflagAsBooleanDimclearFlagAsBoolean
2、PublicFAsLong'DimstartAsboolenPublicreslAsBoolean'运算结果存储在resl里精彩文档实用标准文案PublicffAsDouble'resl里是否为空'////////////////////////////////////////////////////////数字按钮在一个组内,点击按钮输入数字///////////////////////////////////////////PrivateSubcommand1_click(IndexAsInteger)SelectCaseInde
3、xCase1IfNotclearFlagThen'不是等号,那么显示1Text1.Text=Text1.Text&1Else'是等号,那么清空Text1.Text=1clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)'如果第一位的数位0,字符串的长度为2.那么取字符串右面的数,即两个数中右面的数Case2IfNotclearFlagThenText1.Text=Text1.Text&2ElseText1.Text=
4、2clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)Case3IfNotclearFlagThenText1.Text=Text1.Text&3ElseText1.Text=3clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)Case4IfNotclearFlagThenText1.Text=T
5、ext1.Text&4ElseText1.Text=4clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)Case5IfNotclearFlagThen精彩文档实用标准文案Text1.Text=Text1.Text&5ElseText1.Text=5clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1
6、)Case6IfNotclearFlagThenText1.Text=Text1.Text&6ElseText1.Text=6clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)Case7IfNotclearFlagThenText1.Text=Text1.Text&7ElseText1.Text=7clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0"
7、)=1ThenText1=Right(Text1,1)Case8IfNotclearFlagThenText1.Text=Text1.Text&8ElseText1.Text=8clearFlag=FalseEndIfIfLen(Text1.Text)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)Case9IfNotclearFlagThenText1.Text=Text1.Text&9ElseText1.Text=9clearFlag=FalseEndIfIfLen(Text1.T
8、ext)=2AndInStr(1,Text1,"0")=1ThenText1=Right(Text1,1)精彩文档实用标准文案Case0IfNotclearFlagThenText1.Text=Text1.Text&0E