Invalid Index Specified Error

Posted by: dotnetuser on 8 September 2017, 12:40 pm EST

  • Posted 8 September 2017, 12:40 pm EST


    Using Spread .Net 2.05.2008-2005. The spread is being loaded and we're sorting ascending the first column and adding subtotals rows to the spread; also calculating some of the columns.

    But there is an option to display this spread without sorting neither subtotaling. If checked we're clearing the spread and re-populating it. But as soon as we set the RowCount = 0 the following error is being displayed:

    System.IndexOutOfRangeException occurred
      Message="Invalid index specified: 15
    (current length is 15)"
           at b0.a(Int32 A_0, Int32 A_1)
           at FarPoint.Win.Spread.SheetView.OnRemoveRows(Int32 row, Int32 count)
           at FarPoint.Win.Spread.SheetView.OnDataModelChanged(Object sender, SheetDataModelEventArgs e)
           at FarPoint.Win.Spread.Model.SheetDataModelEventHandler.Invoke(Object sender, SheetDataModelEventArgs e)
           at FarPoint.Win.Spread.Model.BaseSheetDataModel.OnChanged(SheetDataModelEventArgs e)
           at FarPoint.Win.Spread.Model.BaseSheetDataModel.FireChanged(Int32 row, Int32 column, Int32 rowCount, Int32 columnCount, SheetDataModelEventType type)
           at FarPoint.Win.Spread.Model.DefaultSheetDataModel.set_RowCount(Int32 value)
           at FarPoint.Win.Spread.SheetView.set_RowCount(Int32 value)

    Tried to reproduce this in a test project loading a spread with a few rows sorting then setting the rowcount to 0 but couldn't reproduce it.

    We're not using databinding the spread is being loaded manually.

    Any ideas what could be the problem? Heard before about it in this release?



  • Replied 8 September 2017, 12:40 pm EST

    If memory serves me correctly there was a bug in one of the earlier versions of 2.5 when setting the row count = 0.  I would suggest getting the latest maintenance release.  If that doesn't solve your problem could you post a small project reproducing the issue.
  • Replied 8 September 2017, 12:40 pm EST

    Downloaded Spread release 2.05 (2011-2005) and it didn't help much.

    Unfortunately I can't reproduce this error in a simple/small test project and I already spent to much time on this.

    In order to make it work we implemented a work around consisting of:

    private void PopulateSpread




          spdXYZ.Sheets[0].RowCount = 0;





               //Re-add the columns a to spread and re-format them

              spdXYZ.Sheets[0].RowCount = 0;


        //Continue populating the spread as usual


    The reset is fixing the problem but it's clearing all thge columns, column headers and therefore we have to re-add the columns again.

    It's good to have this issue fixed though!.





Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels