欢迎来到天天文库
浏览记录
ID:24516553
大小:52.01 KB
页数:4页
时间:2018-11-15
《《计算器窗口设计》word版》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、计算器窗口设计源代码PrivateSubCommand1_Click()Text1.Text=Text1.Text&"1"EndSubPrivateSubCommand10_Click()Text1.Text=Text1.Text&"0"EndSubPrivateSubCommand11_Click()Text1.Text=Text1.Text&"."EndSubPrivateSubCommand12_Click()DimaAsDoublea=Val(Text1.Text)Ifa>0ThenText1.Text=-Val(Text1.Text)Ifa<0The
2、nText1.Text=Abs(Val(Text1.Text))Ifa=0ThenText1.Text="0"IfText1.Text=""ThenText1.Text=0EndSubPrivateSuba()Text2.Text=Text1.TextText1.Text=""EndSubPrivateSubCommand13_Click()CallaLabel1.Caption="+"EndSubPrivateSubCommand14_Click()CallaLabel1.Caption="-"EndSubPrivateSubCommand15_Click(
3、)CallaLabel1.Caption="*"EndSubPrivateSubCommand16_Click()CallaLabel1.Caption="/"EndSubPrivateSubCommand17_Click()Text1.Text=Text1.Text^2EndSubPrivateSubCommand18_Click()Text1.Text=Sqr(Val(Text1.Text))EndSubPrivateSubCommand19_Click()IfVal(Text1.Text)=0Thenj=MsgBox("请输入数字",vbYes,"错误提
4、示")ElseDimiAsInteger,XAsIntegerX=1Fori=1ToText1.TextX=X*iNextiText1.Text=XEndIfEndSubPrivateSubCommand2_Click()Text1.Text=Text1.Text&"2"EndSubPrivateSubCommand20_Click()OnErrorResumeNextSelectCaseLabel1.CaptionCase"+"Text1.Text=Val(Text2.Text)+Val(Text1.Text)Case"-"Text1.Text=Val(Te
5、xt2.Text)-Val(Text1.Text)Case"*"Text1.Text=Val(Text2.Text)*Val(Text1.Text)Case"/"IfVal(Text1.Text)=0Theno=MsgBox("除数不能为0",vbYesNo,"错误提示")ElseText1.Text=Val(Text2.Text)/Val(Text1.Text)EndIfEndSelectEndSubPrivateSubCommand21_Click()Text1.Text=""Text2.Text=""EndSubPrivateSubCommand22_C
6、lick()IfText1.Text=0Thenj=MsgBox("请输入数字",vbYes,"错误提示")ElseText1.Text=1/Val(Text1.Text)EndIfEndSubPrivateSubCommand23_Click()UnloadMeEndSubPrivateSubCommand24_Click()frmAbout.ShowEndSubPrivateSubCommand25_Click()IfText1.Text<>""ThenText1.Text=Left(Text1.Text,Len(Text1.Text)-1)EndIfEn
7、dSubPrivateSubCommand26_Click()Text1.Text=""EndSubPrivateSubCommand3_Click()Text1.Text=Text1.Text&"3"EndSubPrivateSubCommand4_Click()Text1.Text=Text1.Text&"4"EndSubPrivateSubCommand5_Click()Text1.Text=Text1.Text&"5"EndSubPrivateSubCommand6_Click()Text1.Text=Text1.Text&"6"EndSubPriva
8、teSubCommand7_Click
此文档下载收益归作者所有