I have a VB 6.0 pgm and an important function in it I am trying to put a set of strings into an array. I have put important parts of the code below
Dim sortArray() As String
Set rsRoute = gdbFML.OpenReco rdset(strSQL, dbOpenDynaset)
ctr = rsRoute.RecordC ount
ReDim sortArray(0 To ctr)
i = 0
If Not rsRoute.EOF Then
rsRoute.MoveFir st
Do While Not rsRoute.EOF
:
:
tempStr = LVS_item & LVS_desc & LVS_uspd & LVS_activity
sortArray(i) = tempStr
List1.AddItem tempStr, i
List1.Selected( List1.NewIndex) = True
rsRoute.MoveNex t
i = i + 1
Loop
When i put the line in bold, i.e., sortArray(i) = tempStr, the code stops and says 'subscript out of range' I am not able to figure it out. Could someone plz help me out.
Dim sortArray() As String
Set rsRoute = gdbFML.OpenReco rdset(strSQL, dbOpenDynaset)
ctr = rsRoute.RecordC ount
ReDim sortArray(0 To ctr)
i = 0
If Not rsRoute.EOF Then
rsRoute.MoveFir st
Do While Not rsRoute.EOF
:
:
tempStr = LVS_item & LVS_desc & LVS_uspd & LVS_activity
sortArray(i) = tempStr
List1.AddItem tempStr, i
List1.Selected( List1.NewIndex) = True
rsRoute.MoveNex t
i = i + 1
Loop
When i put the line in bold, i.e., sortArray(i) = tempStr, the code stops and says 'subscript out of range' I am not able to figure it out. Could someone plz help me out.
Comment