这个程序运行老是提示出错,我也不知道怎么改了,请大家帮小弟改改,小弟不胜感激!!!
Dim num1, num2 As Single
Dim strnum1, strnum2 As String
Dim firstnum As Boolean
Dim pointflag As Boolean
Dim runsign As Integer
Dim signflag As Boolean
Sub cleardata()
num1 = 0
num2 = 0
strnum1 = ""
strnum2 = ""
firstnum = True
pointflag = False
runsign = 0
signflag = False
Text1.Text = "0."
End Sub
Sub rnu()
num1 = Val(strnum2)
num2 = Val(strnum1)
Select Case runsign
Case 1
equal = num1 + num2
Case 2
equal = num1 - num2
Case 3
equal = num1 * num2
Case 4
equal = num1 / num2
End Select
strnum2 = Str(equal)
strnum1 = strnum2
Text1.Text = strnum2
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 To 9
If firstnum Then
strnum1 = Str(Index)
firstnum = False
Else
strnum1 = strnum1 + Str(Index)
End If
Text1.Text = strnum1
Case 10
If Not pointflag Then
If firstnum Then
strnum1 = "0."
firstnum = False
Else
strnum1 = strnum1 + "."
End If
Else
Exit Sub
End If
pointflag = True
Text1.Text = strnum1
Case 12 To 15
firstnum = True
pointflag = False
'还原标记值
If signflag Then
Call Run
Else
signflag = True
strnum2 = strnum1
strnum1 = ""
End If
runsign = Index - 11
Case 11
If Not signflag Then
Text1.Text = strnum1
equal = Val(strnum1)
firstnum = True
pointflag = False
Else
Call Run
signflag = False
End If
Case Else
Call cleardata
End Select
End Sub
Private Sub Form_Load()
Call cleardata
End Sub