none
stack overflow exception in VB2010, when running the VB2010 app in Win7 x64 and clicking a checkbox. Why? What to do? RRS feed

All replies

  • First check for recursion. I assume you understand what recursion is. There could be unintentional recursion. I don't see anything that that sub is calling that might be relevant except Form2.ShowDialog(). If there is any way that Form2 can call that sub, even indirectly, then obviously that would be a problem. And I assume it would be unintentional; in other words, you might not realize it is happening.

    Have you checked the stack to see what has been called previously? Also look to see if a function in the call stack has created a large object that could require a lot of stack space, such as a large array. I am not sure what in VB is created in the stack and not in the heap.



    Sam Hobbs
    SimpleSamples.Info

    Friday, February 16, 2018 2:12 AM
  • This at first glance is easy (yet may not be so).

    You are changing J17.Checked to True inside of CheckChanged which calls CheckChanged again and again.

    Two ways to fix this, let's look at the easy cheeze way.

    Before changing the Checked property use RemoveHandler fot CheckedChanged, change the value then use AddHandler to re-subscribe to the event, this stops the recursion. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, February 16, 2018 11:16 AM
    Moderator