Results 1 to 9 of 9

Thread: [RESOLVED] On Error Goto Statement Doesn't Work, Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    3

    Resolved [RESOLVED] On Error Goto Statement Doesn't Work, Help

    I have developed all in-house software used within my company with VB. I am currently using VB 6.

    I recently downloaded and installed Vsiual Studio 2010 Beta 2. At the time I was busy developing a new in-house program. I spent about 2 weeks fiddling with VS 2010 before deciding that at my age such a dramatic learnig curve is just not worth the effort considering the success I have thus far achieved using VB 6.

    Upon returning to my half-completed VB 6 project, I discovered that the ON ERROR GOTO statement no longer works. During execution the code simply ignores the ON ERROR GOTO statement as if it does not exist. You undoubtedly are all aware of the result. An unhandled error......

    I have tried everything I could think of: Uninstalling VS 2010 and all associated components. Uninstalling VB 6 and re-installing VB 6, service packs, everything I have. All to no avail. My source code simply ignores the ON ERROR GOTO statement as if it does not exist.

    I do all development on my notebook and then create setup disks for the company PC's. Inadvertantly the .exe files are also present on the notebook. So is the source code. When I run the .exe files, the ON ERROR GOTO statent works just fine. However, when I run the source code from which the .exe files were created, the ON ORROR GOTO statement somehow just becomes inoperative.

    Please, PLEALSE, could anyone help me?? PLEASE.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: On Error Goto Statement Doesn't Work, Help

    Welcome to VBForums

    Right-click somewhere in a code window and select "Toggle", then make sure that the "break on/in" option is not set to "all errors".

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    3

    Re: On Error Goto Statement Doesn't Work, Help

    Thanks for the interest, si. Unfortunately that is not the cause of the problem as break on all errors have been turned on all along.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: On Error Goto Statement Doesn't Work, Help

    Does this happen with new projects too? Try a simple experiment

    1. New form, 1 button
    2. in button's click event
    Code:
    On Error GoTo CATCH_EXCEPTION
       MsgBox 1/0
       Exit Sub
    CATCH_EXCEPTION:
       MsgBox "Error: " & err.Description
    End Sub
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: On Error Goto Statement Doesn't Work, Help

    I think you missed the word "not" in my post.

    "Break on all errors" is the one you definitely don't want, as it explicitly causes your current situation.

    What you will usually want is "Break on Unhandled Errors".

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: On Error Goto Statement Doesn't Work, Help

    The only option I have checked is "Break In Class Module"

  7. #7
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: On Error Goto Statement Doesn't Work, Help

    Quote Originally Posted by Hack View Post
    The only option I have checked is "Break In Class Module"
    Same here.



    To the OP: The only one that's bad is Break on All Errors.

    Well, not bad, and actually quite useful if you want to see if On Error Resume Next is eating a runtime error, but bad in the sense that you can't leave the setting there during normal development. Switch it to either Break On Unhandled Errors or Break In Class Module.

    I know you said you've had it set that way all along, but it's unlikely since the behavior you describe is exactly what that option is meant to do. As opposed to forcing the developer to comment out error handlers when he wants to see raw error messages.

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    3

    Re: On Error Goto Statement Doesn't Work, Help

    Thanks all. Yes, si, I DID miss the word NOT. Peculiar occurrance as all EXE files were fine, but "Break on unhandled erros" was replaced with "Break on all errors" in all my source code which I originally used to create the EXE's. Some source code files have been untouched for years. Guess I got carried away and missed the obvious, hey? Thanks once again all who replied.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: On Error Goto Statement Doesn't Work, Help

    The option is actually for VB itself rather than being project specific, so I'm guessing that at some point you changed it for another project and didn't change it back.


    As you now have it sorted out, could you please do us a little favour, and mark the thread as Resolved?
    (this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)

    You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).

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