请高手看看,哪里错了啊
看看动态数组应该定义多大
Public Function gesuo(text As String) As Integer
Dim i, n As Integer
Dim fh As String
n=1
For i = 1 To Len(text)
fh = Mid(text, i, 1)
Select Case fh
Case Is = "+"
n = n + 2
Case Is = "-"
n = n + 2
Case Is = "*"
n = n + 2
Case Is = "/"
n = n + 2
Case Is = "^"
n = n + 2
Case Is = "("
n = n + 2
Case Is = ")"
n = n + 2
End Select
Next i
gesuo = n + 2
End Function
把字符串中的数字给数组
Public Sub tiqu(n As Integer)
n = gesuo(Text1.text)
ReDim sz(n) As fs
Dim xiaosuo, fensuo As Boolean
Dim fh, kong As String
Dim a, b As Integer
a = 1
b = 1
Dim temp, temp1, temp2 As String
For i = 1 To Len(Text1.text)
fh = Mid(Text1.text, i, 1)
If Val(fh) >= 0 And Val(fh) <= 9 Then
temp = temp + fh
If xiaosuo = True Then
b = b * 10
End If
Else: Select Case fh
Case Is = "."
xiaosuo = True
Case Is = ","
temp1 = temp
temp = kong
Case Is = "_"
temp2 = temp
temp = kong
fensuo = True
Case Else
If xiaosuo = True Then
sz(a).fz = Val(temp)
sz(a).fm = b
b = 1
temp = kong
xiaosuo = False
a = a + 1
sz(a).fz = fh
a = a + 1
Else
If fensuo = True Then
sz(a).fz = Val(temp1) * Val(temp) + Val(temp2)
sz(a).fm = Val(temp)
temp = kong
temp1 = kong
temp2 = kong
a = a + 1
sz(a).fz = fh
a = a + 1
Else
sz(a).fz = Val(temp)
sz(a).fm = 1
a = a + 1
sz(a).fz = fh
a = a + 1
End If
End Select
End If
Next i
End Sub