[Microsoft VBScript runtime (0x800A0009) Subscript out of range: '[number: -1]'] -



Microsoft VBScript runtime (0x800A0009) Subscript out of range: '[number: -1]'

Discuss Microsoft VBScript runtime (0x800A0009) Subscript out of range: '[number: -1]'



Posted by: HackerNeo

[B]Microsoft VBScript runtime (0x800A0009) Subscript out of range: '[number: -1]'[/B]
:D

any Ideas ?

any help would be useful



Posted by: Jack

Where are you seeing this message? Is it client side code that you can enable the debugger to step through the code to determine the offending statement.



Posted by: HackerNeo

the code is server side and I see this when I access a TAB on my page.

Thanks



Posted by: Jack

This is your server side code?

Yes, than I generally fall back to my 'old' debugging techniques and inserting debug statements around any code that utilizes an index, displaying the index and its value. that way at least you can determine where the code is failing.

If you cannot determine the general area where the code is failing then insert debug stmts in the main sections of the code to narrow down to a section and continue until you get to the specific section.



Posted by: HackerNeo

here is the code

response.write replace(ccell,"</td>","")

response.write "<span id=" & q & "spanHeader" & q & " style=" & q & "display:block" & q & ">" & cr
If Len(sHeader) > 0 Then
A_HEADERS = Split(sHeader, C_PARENT_SEP)

iHeadCount = UBound(A_HEADERS,1) + 1

response.write replace(ctblnopad, ">", " height=" & q & "30px" & q & " style=" & q & "background-color:lightgrey" & q & ">")
response.write replace(crow,"</tr>","")

A_HEADER = Split(A_HEADERS(i - 1), C_CHILD_SEP)
response.write replace(ccell,"</td>","")
response.write A_HEADERS(2)
response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")

response.write replace(ccell,"<td>","")
response.write replace(crow,"<tr>","")
response.write ctblend
End If


response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")
response.write replace(ctblnopad, ">", " height=" & q & "30px" & q & " style=" & q & "background-color:lightgrey" & q & ">")
response.write replace(ccell,"</td>","")
response.write A_HEADERS(0)
response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")
response.write A_HEADERS(1)
response.write replace(ccell,"<td>","")
response.write ctblend
response.write replace(crow,"<tr>","")
response.write replace(crow,"</tr>","")
response.write replace(ccell,"</td>","")

the following is the array which is at the top of the code
LoadFrame "", "","Username"& C_PARENT_SEP & "Hour(s) Connected" & C_PARENT_SEP & "Username"& C_PARENT_SEP & "Failed Attempts", c_LAYOUT_DISPLAYSPLITFRAME



Posted by: HackerNeo

sorry code has screwed up your display



Posted by: HackerNeo

array is here
LoadFrame "", "","Username"& C_PARENT_SEP & "Hour(s) Connected" & C_PARENT_SEP & "Username"& C_PARENT_SEP & "Failed Attempts", c_LAYOUT_DISPLAYSPLITFRAME

faulty code here

response.write replace(ccell,"</td>","")

response.write "<span id=" & q & "spanHeader" & q & " style=" & q & "display:block" & q & ">" & cr
If Len(sHeader) > 0 Then
A_HEADERS = Split(sHeader, C_PARENT_SEP)

iHeadCount = UBound(A_HEADERS,1) + 1

response.write replace(ctblnopad, ">", " height=" & q & "30px" & q & " style=" & q & "background-color:lightgrey" & q & ">")
response.write replace(crow,"</tr>","")

A_HEADER = Split(A_HEADERS(i - 1), C_CHILD_SEP)
response.write replace(ccell,"</td>","")
response.write A_HEADERS(2)
response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")

response.write replace(ccell,"<td>","")
response.write replace(crow,"<tr>","")
response.write ctblend
End If


response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")
response.write replace(ctblnopad, ">", " height=" & q & "30px" & q & " style=" & q & "background-color:lightgrey" & q & ">")
response.write replace(ccell,"</td>","")
response.write A_HEADERS(0)
response.write replace(ccell,"<td>","")
response.write replace(ccell,"</td>","")
response.write A_HEADERS(1)
response.write replace(ccell,"<td>","")
response.write ctblend
response.write replace(crow,"<tr>","")
response.write replace(crow,"</tr>","")
response.write replace(ccell,"</td>","")



Posted by: Jack

You set iHeadCount = upper bound of A_HEADERS + 1

but later you access A_HEADERS with i-1, 0, 1, and 2 as the index.

Is there code missing that checks for iHeadCount -1 <= (i-1, 1, 2)?

It may help if you paste the code into something like notepad before pasting into the browser.



Posted by: HackerNeo

No I dont have any code like the codee you posteddo you think this could be my problem?


I dont think that arrays can have a -1 element in them can they ?

hope to hear from you soon



Posted by: psychobrigade00

as far as im away arrays cannot go into a negative or non existant value such as -1. 0 is the lowest an array can go so setting it below zero will cause errors.