|
Subject:
|
Array, Subscript out of range.
|
|
Posted By:
|
koss77
|
Post Date:
|
8/18/2006 1:41:08 PM
|
Please help me debug this problem. The error was the subscript was out of range. here is the code:
Thank very much. The Idea seem to work but I have another problem. The value of -1 is not acceptable index for an array. After I run the code I get this error : "subscript out of range"
Here is the part of the code that with the error: ReDim arrArrTestNewValue(UBound(arrArrayTest)) For n = 0 To UBound(arrFields) For I = 0 To UBound(arrArrayTest) If arrArrayTest(I, 0) = arrFields(n) Then arrArrTestNewValue(I) = n Else arrArrTestNewValue(I) = -1 End If Next I Next n Do While inFile.AtEndOfStream = False record = inFile.ReadLine arrFields = Split(record, Separator) Dim k As Integer If arrArrTestNewValue(k) = -1 Then arrFields(arrArrTestNewValue(k)) = ""
|
|
Reply By:
|
BrianWren
|
Reply Date:
|
8/18/2006 4:31:23 PM
|
What VB flavor are you using? (Looks like v6; zatso?)
|
|
Reply By:
|
koss77
|
Reply Date:
|
8/18/2006 4:37:05 PM
|
I am using VB6
|
|
Reply By:
|
BrianWren
|
Reply Date:
|
8/18/2006 5:29:38 PM
|
VB 6 allows you to specify like: Dim MyArray(-8 To 30) As String ' Just for instance... So you can use negative indices.
|
|
Reply By:
|
koss77
|
Reply Date:
|
8/21/2006 9:35:47 AM
|
Thank you very much. This is very helpfull
|