admin 管理员组文章数量: 1086019
2024年3月27日发(作者:sql update字符串拼接)
VB计算器代码
求VB计算器代码
悬赏分:15 - 解决时间:2007-2-13 13:47
请高手们 明确 我要的是一个
当我们在文本框1内输入1+1 则在文本框2就会出现2 依次类推 2+2 4
还有我还想需要连续的如:1+1+1+1 则2要出现4 不单单是2数之合
现在我只要求有加法,我需要有乘法与除法
请高们们,写代码来‘‘‘
提问者: 陳傑 - 试用期 一级
最佳答案
Option Explicit
Private StoredValue As Double
Private Const opNone = 0 Private Const opAdd = 1 Private Const
opSubtract = 2 Private Const opMultiply = 3 Private Const opDivide = 4
Private Operator As Integer
Private NewEntry As Boolean
' Remove the last character. Private Sub DeleteCharacter() Dim txt
As String
Dim min_len As Integer
txt =
If Left$(txt, 1) = "-" Then min_len = 2
Else
min_len = 1
End If
If Len(txt) > min_len Then = Left$(txt, Len(txt) - 1)
Else
= "0"
End If
End Sub
' Clear the current entry, saved value, and operator.
Private Sub cmdClear_Click() cmdClearEntry_Click
StoredValue = 0
Operator = opNone
End Sub
' Clear the current entry.
Private Sub cmdClearEntry_Click() = ""
End Sub
' Add a decimal point to the display. Private Sub cmdDecimal_Click()
If InStr(, ".") Then Beep
Else
If NewEntry Then
= "."
NewEntry = False
Else
= & "." End If
End If
End Sub
版权声明:本文标题:VB计算器代码 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1711528434a598468.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论