Upgrade to v 4.0.3505 gives ArgumentOutOfRange Exception while setting RowCount to zero

Posted by: keren on 8 September 2017, 1:34 pm EST

  • Posted 8 September 2017, 1:34 pm EST

    Hi!


       I am getting an exception and can't understand why.


    It happens after I have filled the grid once, when I try to clear it (in order to refill it).
    Here is the code:


    private void InitSpread()
    {
    SetSpreadVariables();
    int maxColumns = _models.Count - 1 + ColumnsStatic;
    int maxRows = _artifactCount - 1 + RowStatic;


    //Tooltip
    CalculationSpread.TextTipPolicy = TextTipPolicy.Floating;
    CalculationSpread.TextTipDelay = 10;


    //Clear spread
    CalculationSpread_Sheet1.ColumnCount = 0;
    CalculationSpread_Sheet1.RowCount = 0;


    //Rows and columns
    CalculationSpread_Sheet1.ColumnCount = maxColumns + 1;
    CalculationSpread_Sheet1.RowCount = maxRows + 1;


    ......


    The exception accures on the line marked in red. It says:
    ArgumentOutOfRange Exception
    Invalid low bound argument.
    Parameter name: LargeChange


    I have found this following link with the same problem:
    http://www.clubfarpoint.com/Forums/forums/69530/ShowThread.aspx
    And tried to use ShowCell but it didn't help.


    This problem has started after upgrading to v. 4.0.3505.
    Now I took away all referance to the new DLL and instead linked back to v 4.0.2001 and this doesn't happen.
    the very same code works fine.
    Is there anything about the new version or upgrading that I am missing?


    Thank you in advance,
    Keren

  • Replied 8 September 2017, 1:34 pm EST

    Keren -

    I believe this was similiar to a bug in that version you have which should be fixed in the maintenance release we will be posting soon.

  • Replied 8 September 2017, 1:34 pm EST

    I've been experiencing the exact same problem. This problem seems to occur randomly (but not very often).


    I'm glad to hear that this has been identified and will be fixed. Can you give me/us a date when the next maintenance release is?


    For my curiosity, can you tell me what the cause of the problem?


     


    Thanks

  • Replied 8 September 2017, 1:34 pm EST

    The maintenance should be out in the next couple of weeks.  I do not know what the cause of the problem was.
  • Replied 8 September 2017, 1:34 pm EST

    Hello,


    The problem was caused by setting the RowCOunt of the Spread to 0 after scrolling down the Spread so that row 0 is not the top row. You can programatically work around this now by using the SetViewportTopRow method to scroll to the top of the Spread before setting the RowCount to 0.

  • Replied 8 September 2017, 1:34 pm EST

    Hi Scott,


        I am not so sure that you are correct, at least not in my case. I press the "Get" buttom that reloads the spread twice without doing ANY scroll in between.  
    The problem still appears when pressing the second Get, every time.

    I have tride to put the following line before setting RowCount to 0:
    CalculationSpread.ShowCell(0, 0, 0, 0, FarPoint.Win.Spread.VerticalPosition.Top, FarPoint.Win.Spread.HorizontalPosition.Left);
    But this did not help either. Is using the SetViewportTopRow method that you suggested different than what is done in the above line? (If yes, I will switch to the updated version again and try it).


    Thanks in advance,
    Keren



     

  • Replied 8 September 2017, 1:34 pm EST

    Karen,


    There are two seperate bugs; both of which will be fixed in the maintenance release. One just requires scrolling the Spread a few rows and then setting the RowCount to 0. The other has to do with setting the RowCount to 0 when bound to a DataSource. I thought the second one gave a different exception but it sounds like you are saying they are both the same exception. Both issues will be fixed in the next maintenance release as stated by Bob.

  • Replied 8 September 2017, 1:34 pm EST

    Hello,

    We upgraded to the version 4.2008.2005 because of the same error in the version 4.2005.2005 as descripted (setting rowcount = 0 when bound to a datasource causes an error "The Value is not valid; the value must be between the minimum and the maximum values.", maybe the same effect setting the columncount = 0). But in version 4.2008.2005 the error still happens. So we are a little bit disappointed that the error is not fixed.  Is their a way to workaround this error?

    Greets,

    Ulrich

     

  • Replied 8 September 2017, 1:34 pm EST

    Ulrich,


    I am not familiar with an issue like this with setting the ColumnCount to 0. 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