none
Stack overflow RRS feed

  • Question

  • Hi, I have a listbox and I have a method to select an item in the listbox but I keep getting stack overflow exception and something about an infinite loop (i notice that in my app the selected item rapid changes through them all before crashing after 2 or 3 seconds) so when I set the indices of the listbox out of range it kind of works but I get a different error.

    Thanks

    Tuesday, October 12, 2010 11:23 PM

Answers

  • Let's say that your event handler does something that could possibly influence the current selection.  For example, changing the currently selected item to another.  This runs the event handler again in a recursive loop until the stack is exhausted.  I'd start commenting stuff out of your event handlers on the ListBox 'til you find the problem if you don't have any better ideas what it could be.

     

    • Marked as answer by Chizzy17 Wednesday, October 13, 2010 2:36 AM
    Wednesday, October 13, 2010 1:48 AM

All replies

  • The first thing I'd do is check your event handler.  Any chance you are changing something concerning the same list in that handler?  Making changes to the same control that is notifying you that something has changed is often a recipe for trouble.  The documentation is often weak on explaining what modifications exactly are allowed.  I usually try to be conservative on this.

     

    Wednesday, October 13, 2010 12:33 AM
  •  

    Thanks, but Sorry but I don't really understand you

    Wednesday, October 13, 2010 12:59 AM
  • Let's say that your event handler does something that could possibly influence the current selection.  For example, changing the currently selected item to another.  This runs the event handler again in a recursive loop until the stack is exhausted.  I'd start commenting stuff out of your event handlers on the ListBox 'til you find the problem if you don't have any better ideas what it could be.

     

    • Marked as answer by Chizzy17 Wednesday, October 13, 2010 2:36 AM
    Wednesday, October 13, 2010 1:48 AM
  • it's alright, i figured out da problem
    Wednesday, October 13, 2010 2:36 AM