Post #188,299
12/27/04 2:17:51 PM
|

I think that one means...
..."Go and get a proper database!"
GD&R
Peter [link|http://www.ubuntulinux.org|Ubuntu Linux] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home] Use P2P for legitimate purposes!
|
Post #188,303
12/27/04 2:25:41 PM
|

Re: I think that one means...
The problem is, I have historically neglected to pay much attention to proper error handling.
|
Post #188,307
12/27/04 2:42:20 PM
|

From the 10 Commandments of C Programming:
#6: If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance. And yes, it applies to VB as well. :)
"Here at Ortillery Command we have at our disposal hundred megawatt laser beams, mach 20 titanium rods and guided thermonuclear bombs. Some people say we think that we're God. We're not God. We just borrowed his 'SMITE' button for our fire control system."
|
Post #188,313
12/27/04 4:08:09 PM
|

So.
How does one go about making a global error handler?
|
Post #188,320
12/27/04 4:37:03 PM
|

In VB?
On Error Resume Next was the most popular method I saw. I wouldn't recomend it myself.
Jay
|
Post #188,332
12/27/04 5:30:43 PM
|

Re: In VB?
Yes.
|
Post #188,347
12/27/04 6:29:15 PM
|

You can use On Error GoTo
Or at least you could way back in the day.
I don't know whether Microsoft has now added some form of exception handling to the language. If they did, then use that instead. (Unless it is really, really broken.)
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|
Post #188,501
12/29/04 3:37:21 PM
|

That's still the way
It's the way Microsoft still does it with the auto code in Office 2003
Private Sub Button_Click On Error Goto err_Button_Click code ... exit_Button_Click: Exit Sub err_Button_Click: Msgbox Err.Description Resume exit_Button_Click End Sub
after the err_whatever: tag, you can set up code to compare the Err.Code and handle whatever errors you expect.
~~~)-Steven----
"I want you to remember that no bastard ever won a war by dying for his country. He won it by making the other poor dumb bastard die for his country..."
General George S. Patton
|
Post #188,350
12/27/04 7:33:54 PM
|

That was a joke
That was a joke, not a programming idea. On Error Resume Next tells VB to simply continue with the next step when there is an error. This causes all sorts of havok when there is a real problem.
But if you want a really global error trap, then either put the entire program inside a try/catch block or a global On Error statement at the start.
There isn't much you can do in VB if you catch errors at that level though. All you can do is present some formatted error information and quit.
Jay
|
Post #188,373
12/28/04 5:30:48 AM
|

For certain techniques, it works.
Specifically, the practice of manually checking ErrCode after steps that could catastrophically fail. It's a bit lazy, though for some types of code, the risk of an uncaught error is suitably low.
Wade.
Is it enough to love Is it enough to breathe Somebody rip my heart out And leave me here to bleed
| | Is it enough to die Somebody save my life I'd rather be Anything but Ordinary Please
| -- "Anything but Ordinary" by Avril Lavigne. |
|
Post #188,567
12/30/04 12:26:38 PM
|

Opinions vary on "Global" error checking in VB.
But in general, it is thought to be a bad idea. I'm in that camp.
bcnu, Mikem
Eine Leute. Eine Welt. Ein F\ufffdhrer. (Just trying to be accepted in the New America)
|