IndexOutOfRangeException is thrown while adding a row at the end of the sheet

Posted by: jeetu2268 on 8 September 2017, 2:13 pm EST

  • Posted 8 September 2017, 2:13 pm EST

    System.IndexOutOfRangeException was unhandled by user code
      Invalid row index: 1 (must be between -1 and 0).

    I'm getting this exception while adding a row at the end of the sheet.

    The sheet has 14 columns.

    At the form load event I can successfully add a row to the sheet but when the user enters some data to any of the two columns in the row then I need to add a new row at the end and there i get this exception

    Here is the code,

    <FONT color=#0000ff size=2><FONT color=#0000ff size=2>

    private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> fpSpreadSpareDetails_EditModeOff(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>object</FONT></FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EventArgs</FONT></FONT><FONT size=2> e)


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>             if</FONT></FONT><FONT size=2> (fpSpreadSpareDetails_Sheet1.NonEmptyColumnCount >= 2 && fpSpreadSpareDetails_Sheet1.NonEmptyRowCount == fpSpreadSpareDetails_Sheet1.RowCount)


                             fpSpreadSpareDetails_Sheet1.AddRows(fpSpreadSpareDetails_Sheet1.RowCount, 1);




    Farpoint for winfoms version  4.0.3510.2008

    Thanks in advance.


  • Replied 8 September 2017, 2:13 pm EST


    I am not able to reproduce this issue. We should be posting the new maintenance release of Spread For Windows Forms (version 4.0.xx15) in a little bit. I would suggest downloading this and retesting your project. If you are still having issues, could you post a small zipped project reproducing this issue for us to debug?

Need extra support?

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

Learn More

Forum Channels