|
-
Feb 15th, 2010, 03:33 PM
#1
Thread Starter
New Member
[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.
-
Feb 15th, 2010, 03:57 PM
#2
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".
-
Feb 16th, 2010, 09:39 AM
#3
Thread Starter
New Member
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.
-
Feb 16th, 2010, 09:42 AM
#4
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
-
Feb 16th, 2010, 09:50 AM
#5
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".
-
Feb 16th, 2010, 12:05 PM
#6
Re: On Error Goto Statement Doesn't Work, Help
The only option I have checked is "Break In Class Module"
-
Feb 16th, 2010, 11:55 PM
#7
Re: On Error Goto Statement Doesn't Work, Help
 Originally Posted by Hack
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.
-
Feb 17th, 2010, 12:59 PM
#8
Thread Starter
New Member
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.
-
Feb 17th, 2010, 01:07 PM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|