Index was outside the bounds of the array?
-
Please can anyone provide solution to this? 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 137: { Line 138: Line 139: lngCaseMasterIDAry[i] = Convert.ToDouble(dr["CaseMasterID"]); Line 140: strCaseNoAry[i] = dr["CaseNo"].ToString(); Line 141: strCaseBrief[i] = dr["CaseBrief"].ToString(); Source File: e:\CDRV3WebVersion\CaseMaster.aspx.cs Line: 139 Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] CaseMaster.btnView_Click(Object sender, EventArgs e) in e:\CDRV3WebVersion\CaseMaster.aspx.cs:139 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
-
Please can anyone provide solution to this? 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 137: { Line 138: Line 139: lngCaseMasterIDAry[i] = Convert.ToDouble(dr["CaseMasterID"]); Line 140: strCaseNoAry[i] = dr["CaseNo"].ToString(); Line 141: strCaseBrief[i] = dr["CaseBrief"].ToString(); Source File: e:\CDRV3WebVersion\CaseMaster.aspx.cs Line: 139 Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] CaseMaster.btnView_Click(Object sender, EventArgs e) in e:\CDRV3WebVersion\CaseMaster.aspx.cs:139 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
may be the i is greater then the size of array.
-
Please can anyone provide solution to this? 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 137: { Line 138: Line 139: lngCaseMasterIDAry[i] = Convert.ToDouble(dr["CaseMasterID"]); Line 140: strCaseNoAry[i] = dr["CaseNo"].ToString(); Line 141: strCaseBrief[i] = dr["CaseBrief"].ToString(); Source File: e:\CDRV3WebVersion\CaseMaster.aspx.cs Line: 139 Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] CaseMaster.btnView_Click(Object sender, EventArgs e) in e:\CDRV3WebVersion\CaseMaster.aspx.cs:139 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
-
may be the i is greater then the size of array.
i is initialsize to 0 and array size is set equal to record count?
-
did you define array "lngCaseMasterIDAry" with required size?Debug it you'll get the problem.
Cheers!! Brij
array size is set equal to record count?
-
may be the i is greater then the size of array.
Thanks a lot dear i was been initialized before and was not cleared.therefore it was throwing and exception? Thanks to All.
-
Thanks a lot dear i was been initialized before and was not cleared.therefore it was throwing and exception? Thanks to All.