for the best effect where should the on error goto statement be?
after every input statement? or at the very end of the program...
on error
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
QB and FB imply a local error management. This means that your ON ERROR should be at the start of every subroutine .
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
- {Nathan}
- Veteran
- Posts: 1169
- Joined: Thu Aug 19, 2004 6:08 pm
- Location: The wetlands of central Ohio, USA
- Contact:
Please use code tags. But to something like this:
Code: Select all
ON ERROR GOTO Error
...
...
...
(an error is here, it goes to error)
Error:
PRINT "There has been an error. We are all screwed."
I'm afraid Mystik Shadows is wrong in this case...
QB4.5 has no LOCAL error handling, whatever the online help says (perhaps a bug) ... Local error handling works only with PDS 7.1..or FB.
The error handling routines must be at the end of the main program, or in the main part of the modules. They can't be in the SUBS/FUNCTIONS in QB 4.5
ON ERROR can be used anywhere the program an error could break it and will be active until an ON ERROR GOTO 0 is found. Some people puts it at the first line of the program and leaves it active until it ends. I don't remember if activating ON ERROR produces any overhead....
In PDS 7.1 and FB you can use ON LOCAL ERROR, allowing you to have error handlers local to SUBS and FUNCTIONS.
QB4.5 has no LOCAL error handling, whatever the online help says (perhaps a bug) ... Local error handling works only with PDS 7.1..or FB.
The error handling routines must be at the end of the main program, or in the main part of the modules. They can't be in the SUBS/FUNCTIONS in QB 4.5
ON ERROR can be used anywhere the program an error could break it and will be active until an ON ERROR GOTO 0 is found. Some people puts it at the first line of the program and leaves it active until it ends. I don't remember if activating ON ERROR produces any overhead....
In PDS 7.1 and FB you can use ON LOCAL ERROR, allowing you to have error handlers local to SUBS and FUNCTIONS.
- matt2jones
- Veteran
- Posts: 80
- Joined: Sat Feb 19, 2005 8:29 am
- Location: elsewhere
- Contact:
Yeah, for a catch all errorhandler, just put it after you've dimmed all your vars, but before you're program has begun doing things, and have the errorhandler as a label down on the bottom of the main module... or whatever you call the page that you start on. DON'T PUT IT IN A SUB OR FUNCTION, it won't be able to find it.
Well, I managed to repeat everything that was said before me, while adding nothing new to the debate.
What I ment to say was I am one of the Some people [that] puts it at the first line of the program and leaves it active until it[the program] ends
matt blasts his face off with a shotgun.
Well, I managed to repeat everything that was said before me, while adding nothing new to the debate.
What I ment to say was I am one of the Some people [that] puts it at the first line of the program and leaves it active until it[the program] ends
matt blasts his face off with a shotgun.
Do not mistake Apathy for feeling Content.
http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic
http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic