Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Index was outside the bounds of the array?

Index was outside the bounds of the array?

Scheduled Pinned Locked Moved ASP.NET
data-structuresdatabasedesigndebugginghelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mdrizwan_1
    wrote on last edited by
    #1

    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

    G B 2 Replies Last reply
    0
    • M mdrizwan_1

      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

      G Offline
      G Offline
      Gaurav Dudeja India
      wrote on last edited by
      #2

      may be the i is greater then the size of array.

      M 2 Replies Last reply
      0
      • M mdrizwan_1

        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

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        did you define array "lngCaseMasterIDAry" with required size?Debug it you'll get the problem.

        Cheers!! Brij

        M 1 Reply Last reply
        0
        • G Gaurav Dudeja India

          may be the i is greater then the size of array.

          M Offline
          M Offline
          mdrizwan_1
          wrote on last edited by
          #4

          i is initialsize to 0 and array size is set equal to record count?

          1 Reply Last reply
          0
          • B Brij

            did you define array "lngCaseMasterIDAry" with required size?Debug it you'll get the problem.

            Cheers!! Brij

            M Offline
            M Offline
            mdrizwan_1
            wrote on last edited by
            #5

            array size is set equal to record count?

            1 Reply Last reply
            0
            • G Gaurav Dudeja India

              may be the i is greater then the size of array.

              M Offline
              M Offline
              mdrizwan_1
              wrote on last edited by
              #6

              Thanks a lot dear i was been initialized before and was not cleared.therefore it was throwing and exception? Thanks to All.

              B 1 Reply Last reply
              0
              • M mdrizwan_1

                Thanks a lot dear i was been initialized before and was not cleared.therefore it was throwing and exception? Thanks to All.

                B Offline
                B Offline
                Brij
                wrote on last edited by
                #7

                :)

                Cheers!! Brij

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups