帮我看看 这个 小程序有啥问题 为什么老是提示 下标超届
在TEXT1内输入 一些字符 可以把字符两个两个放入 动态数组a()请高手 帮忙看看, 谢谢!
Private Sub Command1_Click()
Dim a()
Dim b()
Dim St As String
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
n = Len(Text1.Text)
ReDim b(Len(Text1.Text))
For i = 0 To Len(Text1.Text)
b(i) = Mid(Text1.Text, i + 1, 1)
Next i
j = n / 2
If n Mod 2 = 1 Then
ReDim a(j + 1)
For x = 0 To j
a(x) = b(2 * x) & b(2 * x - 1) '这里总是提示下标超届
Next x
a(j + 1) = b(n - 1)
Else
ReDim a(j)
For y = 0 To j
a(y) = b(2 * y) & b(2 * y - 1)
Next y
End If
For z = 0 To UBound(a())
Debug.Print a(z)
Next z
End Sub