Home Forums WinForms controls Xceed Grid for WinForms Exception resulting from OnPaint

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15998 |

    I’ve got a grid that is being updating synchronously in the main UI thread. I ultimately receive this exception originating from the Xceed grid. I’m catching this exception in the overridden WndProc but the grid can not recover (draws a red x) over this control from then on. The version of the grid is 3.0.6113.0.

    My dev team is going on a week trying to figure out this problem, so if someone can help me, I’ll be a hero!

    Thanks

    Here are the exception details:
    System.ArgumentOutOfRangeException occurred
    Message=”The index must be greater than or equal to 0 and less than Count.
    Parameter name: index
    Actual value was 1.”
    Source=”Xceed.Editors”
    ParamName=”index”
    StackTrace:
    at Xceed.Utils.Exceptions.ThrowException.ThrowArgumentOutOfRangeException(String paramName, object value, String message)
    at Xceed.Utils.Collections.ListBase.ListGetItem(Int32 index)
    at Xceed.Grid.Collections.VisibleRowList.get_Item(Int32 index)
    at Xceed.Grid.PaintManager.CalculateBodyVisibleRows(Graphics graphics, Rectangle& gridRectandle)
    at Xceed.Grid.PaintManager.Update()
    at Xceed.Grid.PaintManager.get_VerticalScrollRequired()
    at Xceed.Grid.PaintManager.PaintGridBackground(PaintEventArgs e)
    at Xceed.Grid.GridControl.OnPaint(PaintEventArgs e)
    at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
    at System.Windows.Forms.Control.WmPaint(Message& m)
    at System.Windows.Forms.Control.WmProc(Message& m)
    at Xceed.Grid.GridControl.WndProc(Message& m)

    Imported from legacy forums. Posted by Todd (had 2488 views)

    Xceed Support
    Member
    Post count: 5658

    Could you send a snippet of the code from where the exception is thrown?

    Looking at the error, it seems that (in the code), you are referring to an item (through an index) that is no longer in the collection.

    Imported from legacy forums. Posted by CharlesB (had 212 views)

    User (Old forums)
    Member
    Post count: 23064

    I had a similar issue with the grid displaying the red X. After a couple of weeks of trial and error I believe I have isolated the issue. I was attempting to add rows to the grid on a separate thread that could be call asynchronously. When I changed the code to add to the grid from the UI thread synchronously this resolved the problem. I also tested using method invokers with the asynchronous call but the red x still appeared. Hope this will be off help.

    Imported from legacy forums. Posted by Matthew (had 3590 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.