vb 下标越界怎么解决?
用的是listbox控件,源码程序代码:
Dim AssStations() As String Private Sub Form_Load() Dim Tmp1, Tmparray1 ReDim AssStations(0) As String If Dir(App.Path & "\adult.dat") <> "" Then Open App.Path & "\adult.dat" For Input As #1 aLista.Clear While Not EOF(1) Line Input #1, Tmp1 If Trim(Tmp1) <> "" Then Tmparray1 = Split(Tmp1, "||>") ReDim Preserve AssStations(UBound(AssStations) + 1) As String If Tmparray1(0) <> "" Then AssStations(UBound(AssStations) - 1) = Trim(Tmparray1(1)) '下标越界,错误提示来自这一行。怎么解决 aLista.AddItem Trim(Tmparray1(0)) End If End If Wend Close #1 End If End Sub
[ 本帖最后由 ymhy12345 于 2012-12-27 13:50 编辑 ]