ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:25.19KB ,
资源ID:14290310      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-14290310.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VB计算器界面设计全部代码.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

VB计算器界面设计全部代码.docx

1、VB计算器界面设计全部代码VB计算器此计算器能够实现加减乘除等一系列的功能。还有实现显示系统时间的附加功能。程序设计:0-9和点在command1的组内。其他的按钮式运算符和其他功能。正切和余切有对特殊值进行警告, 除也有对除数为零的情况提示警告, 还有阶乘等一系列计算溢出的情况提出警告,还有很多需要完善。 。这仅供参考。Public sum As DoublePublic k As Stri ngPublic dia n As Boolea nPublic b As In tegerPublic poin tflag As Boolea nDim clearFlag As Boolea nP

2、ublic F As LongDim start As boole nPublic resl As Boolean 运算结果存储在 resl里Public ff As Double resl 里是否为空数字按钮在一个组内,点llllllllllllllllllllllllllllllllllllllllllllllllllllllll击按钮输入数字 lllllllllllllllllllllllllllllllllllllllllllPrivate Sub comma nd1_click(l ndex As In teger)Select Case In dexCase 1If Not cle

3、arFlag The n 不是等号,那么显示 1Text1.Text = Text1.Text & 1Else 是等号,那么清空Text1.Text = 1clearFlag = FalseEnd IfIf Len(Text1.Text) = 2 And InStr(1, Text1, 0) = 1 Then Text1 = Right(Text1, 1)如果第一位的数位 0,字符串的长度为 2.那么取字符串右面的数,即两个数中右面的数Case 2If Not clearFlag ThenText1.Text = Text1.Text & 2ElseText1.Text = 2clearFla

4、g = FalseEnd IfIf Len (Text1.Text) = 2 And In Str(1, Text1, 0) = 1 The n Text1 : Case 3If Not clearFlag The nText1.Text = Text1.Text & 3Else=Right(Text1, 1)Text1.Text clearFlag = End If=3FalseIf Len (Text1.Text) = 2 And In Str(1, Text1, 0) = 1 The n Text1 :=Right(Text1, 1)Case 4If Not clearFlag The

5、nText1.Text=Text1.Text & 4ElseText1.Text=4clearFlag =FalseEnd IfIf Len (Text1.Text) = 2 And In Str(1, Text1, 0) = 1 The n Text1 :=Right(Text1, 1)Case 5If Not clearFlag ThenTextl.Text = Textl.Text & 5ElseTextl.Text = 5clearFlag = FalseEnd IfIf Len(Text1.Text) = 2 And InStr(1, Text1, 0)=1 The n Text1

6、=Right(Text1, 1)Case 6If Not clearFlag The nText1.Text=Text1.Text & 6ElseText1.Text=6clearFlag = End IfFalseIf Len(Text1.Text) = 2 And InStr(1, Text1, 0)=1 The n Text1 =Right(Text1, 1)Case 7If Not clearFlag The nText1.Text = Text1.Text & 7ElseTextl.Text = 7clearFlag = FalseEnd IfIf Len(Textl.Text) =

7、 2 And InStr(1, Textl, 0) = 1 Then Textl = Right(Text1, 1)Case 8If Not clearFlag The nTextl.Text = Textl.Text & 8ElseTextl.Text = 8clearFlag = FalseEnd IfIf Len(Textl.Text) = 2 And InStr(1, Textl, 0) = 1 Then Textl = Right(Text1, 1)Case 9If Not clearFlag The nText1.Text = Text1.Text & 9ElseText1.Tex

8、t = 9clearFlag = FalseEnd IfIf Len(Text1.Text) = 2 And InStr(1, Text1, 0) = 1 Then Text1 = Right(Text1, 1)Case 0If Not clearFlag ThenTextl.Text = Textl.Text & 0ElseText1.Text = 0 clearFlag = False End IfIf Len(Text1.Text) = 2 And InStr(1, Text1, 0) = 1 Then Text1 = Right(Text1, 1)Case 10If Not clear

9、Flag The nText1.Text = Text1.Text + .ElseText1.Text =clearFlag = FalseEnd If7/ 对输入点 的个数进行约 束/If (In Str(Text1.Text, .)=1) The n对点的处理,检查是否有点,有点再输入的话为空,否则加入其中Textl.Text =End IfIf InStr(Text1.Text, .) Len(Textl.Text) Then Textl.Text = Left(Text1.Text, Len(Textl.Text) - 1) End IfEnd SelectText1.SetFocus

10、End Sub定义加号按钮 /Private Sub comma nd2_click()If Text1.Text = The nEnd IfIf Trim(Text1.Text) Thensum = Text1.TextText1.Text =k = +ElseExit SubEnd IfEnd Sub7/ 定义减号按钮 /Private Sub comma nd3_click()If Text1.Text = ThenEnd IfIf Trim(Text1.Text) The nsum = Text1.Text 第一个数字填入方框里Text1.Text = 方框的值置空k =-ElseEx

11、it SubEnd IfEnd Sub/ 定义乘号按钮 /Private Sub comma nd4_click()If Text1.Text = The nEnd IfIf Trim(Text1.Text) Then sum = Text1.TextText1.Text =k = *ElseExit SubEnd IfEnd Sub定 义 除 号 按 钮/Private Sub comma nd5_click()If Text1.Text = ThenEnd IfIf Trim(Text1.Text) Then sum = Text1.TextText1.Text =k = /ElseExi

12、t SubEnd IfEnd SubIIIIIIIIIIIIIIIIIIIIIIIIIIII 定 义 sin 号 按 钮/Private Sub comma nd1O_click()If Text1.Text = ThenEnd IfIf Trim(Text1.Text) The nsum = Text1.Textk = si nElseExit SubEnd IfEnd Sub/ 定 义 cos 按 钮/Private Sub comma nd11_click()If Text1.Text = The nEnd IfIf Trim(Text1.Text) The nsum = Text1.T

13、extk =cosElseExit SubEnd IfEnd Sub/ 定义 tan 按钮 /Private Sub comma nd12_click()If Text1.Text = The nEnd IfIf Trim(Text1.Text) The nsum = Text1.Textk = tanElseExit SubEnd IfEnd Sub/ 定义 cot 按钮 /Private Sub comma nd13_click()If Text1.Text = The nEnd IfIf Trim(Text1.Text) Then sum = Textl.Textk = cotElseE

14、xit SubEnd IfEnd Sub7/ 定义人按钮 /Private Sub Comma nd14_click()If Textl.Text = The nExit SubEnd IfIf Trim(Textl.Text) The nsum = Textl.TextTextl.Text =k = AElseExit SubEnd IfEnd Sub/ 定 义 2A/Private Sub comma nd15_click()If Textl.Text = The nExit SubEnd IfIf Trim(Textl.Text) The nsum = Textl.Textk = 2人E

15、lseExit SubEnd IfEnd Sub/ 定义 3A 按钮 /Private Sub comma nd16_click()If Textl.Text = The nExit SubEnd IfIf Trim(Textl.Text) The nsum = Textl.Textk = 3AElseExit SubEnd IfEnd SubIIIIIIIIIIIIIIIIIIII 定义 X!按钮 /Private Sub comma nd17_click()If Text1.Text = The nExit SubEnd IfIf Trim(Text1.Text) The nsum = T

16、ext1.Textk = x!ElseExit SubEnd IfEnd Sub/ 定义 sqrt 按钮 /Private Sub comma nd18_click()If Text1.Text = The nExit SubEnd IfIf Trim(Text1.Text) The nsum = Text1.Textk = sqrtElseExit SubEnd IfEnd Sub/ 定义阶乘的函数 /Private Fu nction Ni(N As Long) As Boolea n Ni = FalseDim Mm As Long Dim F1 As Lo ngF = 1For Mm

17、= 1 To NIf Mm 12 The n If F1 The n Ni = False Exit Fun cti on End IfF = F * MmNext MmNi = TrueEnd FunctionPrivate Sub equalbut_click() clearFlag = FalseEnd SubPrivate Sub comma nd6_click()If Trim(Text1.Text) Then Dim F As DoubleDim a As DoubleDim pi As DoubleDim i, j As In tegerpi = 3.14159265358979

18、If Text1.Text 2147483647 ThenMsgBox 溢出,请确认, vbExclamation, Me.CaptionExit SubEnd If a = Text1.Text clearFlag = TrueIf k = + Then sum = sum + a Text1.Text = sumElseIf k = s in The n sum = Sin(a * pi / 180) Textl.Text = sumElseIf k = cos ThenDim t As In tegert = a Mod 180 - 90If t = 0 ThenText1.Text =

19、 0Elsesum = Cos(a * pi / 180)Textl.Text = sumEnd IfElseIf k = tan ThenDim m As In tegerDim N As In tegerIf m = 0 The nMsgBox Elsem = a Mod 180 - 90(90+180*n )度的正切值无意义,请重新输入sum = (Tan(a * pi / 180)Textl.Text = sumEnd IfElseIf k = cot The nIf a = 0 The nMsgBox 0 度余切没有意义!请重新输入!Elsesum = 1 / (Tan(a * pi

20、 / 180)Textl.Text = sumEnd IfElseIf k = x! The nIf Text1.Text 0 The nCall fact(Text1.Text, F) Text1.Text = FElseIf Text1.Text = 0 The nsum = 1 Text1.Text = sumElseIf Text1.Text = 0 The nsum = Math.Sqr(a)Textl.Text = sumElseMsgBox 开方数不能为负数! ”End If减法运算Elself k = A The n sum = sum a a Textl.Text = sum

21、Elself k = - The n sum = sum - a Textl.Text = sumresl = 1Elself k = * The n sum = sum * a Textl.Text = sumElself k = / The nIf Textl.Text = 0 The nMsgBox 除数不能为零!请重新输入Textl.Text =Elsesum = sum / aTextl.Text = sumIf Len( Textl.Text) 14 The nMsgBox 溢出,请确认, vbExclamation, Me.CaptionExit SubEnd IfExit Su

22、bEnd IfEnd IfEnd IfEnd SubPrivate Sub Comma nd9_Click()If Len(Text1.Text) = 2 ThenText1.Text = Left(Text1.Text, Len(Text1.Text) - 1)ElseText1.Text =End IfEnd SubPrivate Sub form。ad()pi = 4 * Atn(1)poin tflag = FalseclearFlag = FalseEnd SubPrivate Sub comma nd7_click()Uni oad Form4End SubPrivate Sub comma nd8_click()Textl.Text =End SubPrivate Sub Label1_Click()Label1.Capti on = TimeEnd SubPrivate Sub Timer1_Timer()Label1.Capti on = TimeEnd SubPrivate Sub nu mberic(s As In teger)End Sub

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2