鱼C论坛

 找回密码
 立即注册
查看: 2672|回复: 3

VB6编写计算器 ,别的都可以,就是 怎么样能使运算符可以重复按多次,请高手指引下

[复制链接]
发表于 2012-11-5 20:40:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
按重复数字行    但是按加减乘除就不行了   请高手指导下

                               
登录/注册后可看大图

QQ截图20121105204546.png[img]QQ截图20121105204546.png

                               
登录/注册后可看大图
[/img]
Dim a As Integer
Dim s As String
Private Sub Command1_Click()
Text1.Text = Text1.Text & Command1.Caption
End Sub

Private Sub Command10_Click()
Text1.Text = Text1.Text & Command10.Caption
End Sub

Private Sub Command11_Click()
Text1.Text = ""
End Sub

Private Sub Command12_Click()
On Error Resume Next
If s = "+" Then
Text1.Text = Val(Text1.Text) + a
ElseIf s = "-" Then
Text1.Text = a - Val(Text1.Text)
ElseIf s = "*" Then
Text1.Text = Val(Text1.Text) * a
ElseIf s = "/" Then
Text1.Text = a / Val(Text1.Text)
End If
End Sub

Private Sub Command13_Click()
a = Text1.Text
Text1.Text = ""
s = "+"
End Sub

Private Sub Command14_Click()
a = Text1.Text
Text1.Text = ""
s = "-"
End Sub

Private Sub Command15_Click()
a = Text1.Text
Text1.Text = ""
s = "*"
End Sub

Private Sub Command16_Click()
a = Text1.Text
Text1.Text = ""
s = "/"
End Sub

Private Sub Command2_Click()
Text1.Text = Text1.Text & Command2.Caption
End Sub

Private Sub Command3_Click()
Text1.Text = Text1.Text & Command3.Caption
End Sub

Private Sub Command4_Click()
Text1.Text = Text1.Text & Command4.Caption
End Sub

Private Sub Command5_Click()
Text1.Text = Text1.Text & Command5.Caption
End Sub

Private Sub Command6_Click()
Text1.Text = Text1.Text & Command6.Caption
End Sub

Private Sub Command7_Click()
Text1.Text = Text1.Text & Command7.Caption
End Sub

Private Sub Command8_Click()
Text1.Text = Text1.Text & Command8.Caption
End Sub

Private Sub Command9_Click()
Text1.Text = Text1.Text & Command9.Caption
End Sub
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2012-11-5 20:43:38 | 显示全部楼层
Private Sub Command13_Click()
a = Text1.Text      ‘   这个的问题
Text1.Text = ""
s = "+"
End Sub
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-12-11 21:05:07 | 显示全部楼层
没看明白,什么问题
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2013-2-2 13:35:51 | 显示全部楼层
加标志位,就可以解决了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-15 17:48

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表