Server Error in '/' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:


Line 325:  Protected Sub imgbtnNavBack_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles imgbtnNavBack.Load
Line 326:    Dim tmpfly As Fly, count As Integer = 0
Line 327:    For Each tmpfly In Cat.arrCat(Cat.arrCat.Count - 1).arrFlysInCat()
Line 328:      ' Locate Fly_id, so we can obtain next / previous flies
Line 329:      'TODO: Optimization, this is not the most efficient way of finding the fly

Source File: D:\inetpub\83.138.179.122\fish4flies_v2.0\FlyShop\FlyDetails.aspx.vb    Line: 327

Stack Trace:


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +62
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +12
   System.Collections.Generic.List`1.get_Item(Int32 index) +2583412
   FlyShop_FlyDetails.imgbtnNavBack_Load(Object sender, EventArgs e) in D:\inetpub\83.138.179.122\fish4flies_v2.0\FlyShop\FlyDetails.aspx.vb:327
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832