I have a program that at startup must fill a treeview. However one branch of the treeview is getting very huge. In fact so huge that I get an "Out of stack" error.
Is there some way in VB that I can change the stack size?
I would put logging code into every function that you call when building the tree, and when you get the out-of-stack error, you can examine the log for out of control recursion.
Chip H.
If you want to get the best response to a question, please check out FAQ222-2244 first
you could also follow the code step by step with the little red circle thingys. (click to the right of a line & it will automatically debugg when it gets there)
Or.. you could set breakpoints like ferretrunner says. But I've found that when tracking recursion problems down on a form, the act of debugging causes problems as focus changes from your program to the VB IDE, and back again.
You can minimize this problem by running on a PC that has dual monitors (VB on one, program under test on the other one). Or you instrument your code like I suggested earlier.
Chip H.
If you want to get the best response to a question, please check out FAQ222-2244 first
One thing I've found is that, especially with the treeview, is to populate a branch only when it is expanded. Why populate a whole tree view if they only go down one branch?
When you populate a branch put in a child node for each element you add. This node is a dummy node that will be removed when you do the real populating but will cause its parent to have the + - box. Explorer used to behaive like this. If yo want the newer behaivor you'll have to populate 1 level lower then what is visible.
Both these problem solve the recursion problem as you only go into the routine when a branch is expanded.
Hope I've been helpful,
Wayne Francis
If you want to get the best response to a question, please check out FAQ222-2244 first
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.