You must Sign In to post a response.

Index was outside the bounds of the array

The forum thread has not been reviewed by Editors yet. Readers are advised to use their best judgement before accessing this thread.
This thread will be reviewed shortly.
If you think this thread contain inappropriate content, please report to webmaster.
Hi,
I am facing the following error frequently. Give me a solution.
----------------------------------------------------------------------------------------------------------------
Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 115: '''''execute query
Line 116: ''''conn.Close()
Line 117: result(ii, n) = gr(n)
Line 118: n = n + 1
Line 119: Next


Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
resource_check.Page_Load(Object sender, EventArgs e) in D:\application\resource_check.aspx.vb:117
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

------------------------------------------------------------------------------------------------------------------
Thanks in advance,
P.Nellaikumar


Comments

Author: Pavan Kumar Komaragiri08 Dec 2005 Member Level: Bronze   Points : 2

You are index value grater then the array you have declared

suppose you have declared
Dim gr(10)

but the loop is going beyond 10

Author: Pavan Kumar Komaragiri08 Dec 2005 Member Level: Bronze   Points : 2

This error will occur when index value grater then the array you have declared

suppose you have declared
Dim gr(10)

but the loop is going beyond 10

Author: Sandip Naskar08 Dec 2005 Member Level: Gold   Points : 2

Hi,

The error you described is very generic and not related to ASP.NET only.

This happens due to the fact that result or gr array values are over flowing the array dimension.

So, check the dimention of both the arrays and debug the line where you assign value to arrays.

Hope this information helps you,

Thank you,
Sandip


Sign In to post your comments