添加的图片的按钮还没写代码 不知道怎么弄。 还有windows自带的计算器按了+-*/这些运算符后 第一次输入的数字并不会消失。而我这个在输入数字,再按运算符后 数字就会消失了。另外比如1÷3 按=后出来的答案小数点前的0不显示。谁帮我改改
Dim equalsym As Boolean
Dim pointsym As Boolean
Dim computetype As String
Dim FirstNum As Double
Option Explicit
Private Sub cmdAddPicture_Click()
End Sub
Private Sub cmdClear_Click()
txtoutput.Text = ""
pointsym = False
End Sub
Private Sub cmdCompute_Click(Index As Integer)
FirstNum = Val(txtoutput.Text)
txtoutput.Text = ""
Select Case Index
Case 0
computetype = "Add"
Case 1
computetype = "subtraction"
Case 2
computetype = "multiplication"
Case 3
computetype = "division"
End Select
equalsym = False
pointsym = False
End Sub
Private Sub cmdEqual_Click()
If equalsym = False Then
Select Case computetype
Case "Add"
txtoutput.Text = Str(FirstNum + Val(txtoutput.Text))
Case "subtraction"
txtoutput.Text = Str(FirstNum - Val(txtoutput.Text))
Case "multiplication"
txtoutput.Text = Str(FirstNum * Val(txtoutput.Text))
Case "division"
txtoutput.Text = Str(FirstNum / Val(txtoutput.Text))
End Select
equalsym = True
End If
pointsym = False
End Sub
Private Sub cmdNegative_Click()
txtoutput.Text = Trim(Str(-Val(txtoutput.Text)))
End Sub
Private Sub cmdPoint_Click()
If pointsym = False Then
If txtoutput.Text = "" Then txtoutput.Text = "0"
txtoutput.Text = txtoutput.Text & "."
pointsym = True
End If
End Sub
Private Sub form_load()
equalsym = False
pointsym = False
End Sub
Private Sub cmdNumber_Click(Index As Integer)
If equalsym = True Then
txtoutput = ""
equalsym = False
End If
txtoutput.Text = txtoutput.Text & Trim(Str(Index))
End Sub
[此贴子已经被作者于2007-5-10 19:41:42编辑过]