Hello. I'm new to kix, and am having trouble reading from an array. I think I've got it set up correctly, but when I try to display the contents element by element, UBound returns -1, so I cannot display anything. What am I doing wrong?

code:
Break on

$sUserText = "users.txt"

$iUserNum = 0
If Open(2, $sUserText, 2) = 0
Dim $aUserArray[0]
While $Error = 0
$sLine = ReadLine(2)
$error = @error
if $sLine <> ""
ReDim preserve $aUserArray[UBound($aUserArray)+1]
$aUserArray[UBound($aUserArray)] = $sLine
endif
Loop
Close(2)
Endif

MessageBox(UBound($aUserArray), "debug", 0)

for $iCurrentNum = 0 TO UBound($aUserArray)
MessageBox($aUserArray[$iCurrentNum], "debug", 0)
next

Users.txt is simply a text file with a user name on each line. Any help would be greatly appreciated. Thanks!
_________________________
Lost: [i]/dev/sanity