Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2007, 09:10 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default Stack Overflow Exception??

Everytime i run my code i get this stack overflow exception and its troubleshooting tips are make sure there isn't and infinite loop or recursion. What does all this mean?

Cheers

------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
__________________
Apocolypse2005, I'm a programmer - of sorts.
 
Old November 11th, 2007, 12:19 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

To get a better idea of what is causing this, open your call stack window in VS (Debug --> Windows --> Call Stack) and that should give you an idea of what is causing it. I assume you know what an infinte loop is and recursion can also be likend to an infite loop if implemented incorrectly, consider:

Private Sub foo()
   Dim i as Integer = 0
   While i = 0
     foo()
   End While
End Sub

So recursion is the technique whereby a Method or Function calls itself until some condition is met but, as the example above shows, there is no condition to stop the recursion since i is never incremented the While loop will continue to call the method foo()

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old January 17th, 2008, 07:06 PM
Registered User
 
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can also get a recursion loop if your code is firing off multiple events. For example. You might handle a textchanged event on a textbox control and then modify the text accordingly, like change to uppercase for user input, but this triggers off the textchanged event again, and so on.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursive algorithm causing stack overflow rharris VB.NET 2002/2003 Basics 8 July 7th, 2005 12:48 PM
Resursive algorithm causing stack overflow rharris Pro VB.NET 2002/2003 1 July 4th, 2005 11:00 AM
Recursive algorithm causing stack overflow rharris VB.NET 1 July 4th, 2005 10:57 AM
XSLT Stack overflow diebald XSLT 2 September 1st, 2004 12:59 AM
Urgent: Stack Trace Property of SQLCE Exception rcmetta BOOK: Professional Crystal Reports for VS.NET 1 May 11th, 2004 12:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.