Results 1 to 4 of 4

Thread: ARGGGHHH! What is wrong with my program??

  1. #1

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171

    ARGGGHHH! What is wrong with my program??

    Hello. Every time I test this little program it gives me this error:
    An unhandled exception of type 'System.StackOverflowException' occurred in Unknown Module.
    Could somebody please test my program and tell me if you get the same message? I've attached all the files and everything needed to test my project.

    ANY help would be greatly appreciated.
    Furry
    Attached Files Attached Files
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

  2. #2
    Member
    Join Date
    Sep 2001
    Location
    Fishburn
    Posts
    45
    Your problem is the line...

    Dim frmTagger As New frmTagger()

    What happens is a new object frmTagger is created, which tries to create a new object of frmTagger, which in turn tries to create another object, and so on, and so on.

    All you need do is remove that line, and also change the line...

    frmTagger .Close()

    to be

    Close()

    The reason it will work then is because the project properties its already set that the startup object is frmTagger, so you don't need to create the object in code.

    The only time you'd use the method you're using, is if you want to create this object from another module or class. For example if you're startup object is Sub Main rather than a particular form.

  3. #3
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    I've found your problem:

    Code:
    Public Class frmTagger
    	Inherits System.Windows.Forms.Form
    
    	Dim frmTagger As New frmTagger()
    
    #Region " Windows Form Designer generated code "
    
    	Public Sub New()
    		MyBase.New()
    
    		'This call is required by the Windows Form Designer.
    		InitializeComponent()
    
    		'Add any initialization after the InitializeComponent() call
    
    	End Sub
    ...
    ...
    I've seen 'OutOfStackSpace' exceptions before, when I accidently had a repeating procedure (ex. A procedure that calls itself will give you this exception).

    A StackOverflowException, I believe, is something similar. Your declaring a new form (frmTagger is set as the startup object, so its being instantiated automatically by .NET), and that form is re-declaring itself.

    Just remove the code in bold, and your program should work just fine.


    EDIT:

    Darn, fatdaz beat me to it!

  4. #4

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    LOL! Thankyou Thankyou Thankyou Thankyou THANKYOU!! In the eternal words of Dr. Frankenstein,

    IIIIIT LIIIIIIIVES!!!

    Thanks again, both of you. I love this forum!! I think I'll click on that ad few (hundred) times now. Muahahahaha!
    Last edited by Fat_N_Furry; Oct 31st, 2002 at 03:50 PM.
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width