JadeKnight
IS-IT--Management
Hi, I've got a problem with a ReDim of a multidimesional array. I can't figur out what's wrong. Any help would be appreciated.
Error : Microsoft VBScript runtime error: Subscript out of range: '1'
Basically this is this line :
This is the whole sub wich is failing :
I don't get it. If I declare the array with a fixed size wich I know is equal or greater than the result it works fine...
Error : Microsoft VBScript runtime error: Subscript out of range: '1'
Basically this is this line :
Code:
aIndex(iCnt,iDim1) = sLine
This is the whole sub wich is failing :
Code:
'Open Virtual File System
Set oVfs = oFso.OpenTextFile(s, FORREADING)
iCnt = 0
iDim0 = 0
iDim1 = 1
'Read Virtual File System into array
Do Until oVfs.AtEndOfStream
sLine = oVfs.ReadLine
ReDim Preserve aIndex(iCnt,iCnt)
aIndex(iCnt,iDim0) = Left(sLine, InStr(sLine, "|") -1)
aIndex(iCnt,iDim1) = sLine
iCnt = iCnt + 1
Loop
I don't get it. If I declare the array with a fixed size wich I know is equal or greater than the result it works fine...