Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Generic Error Handling.


Reply
 
Thread Tools Display Modes
  #1  
Old 03-11-2002, 01:11 PM
degzk
Guest
 
Posts: n/a
Default Generic Error Handling.


OK. I know I've seen this here somewhere before, but I can't find it !!

I want to write an error handler, possibly using a module that I can include into any project.

Can anyone point me in the right direction please. ?

Cheers
Degz.
Reply With Quote
  #2  
Old 03-11-2002, 01:31 PM
ChiefRedBull's Avatar
ChiefRedBull ChiefRedBull is offline
ISearchGoogle

Retired Moderator
* Expert *
 
Join Date: May 2001
Location: england
Posts: 6,321
Default

Theres been millions of threads about this recently, searching the forum would be a great start.
__________________
Chuck Norris ordered a Big Mac at Burger King, and got one.
Reply With Quote
  #3  
Old 03-11-2002, 01:33 PM
orufet's Avatar
orufet orufet is offline
Paranoid Coder

Retired Leader
 
Join Date: Mar 2001
Location: Canada
Posts: 2,716
Default

There are a couple of tutorials in the Tutor's Corner about debugging programs and error handling, you might want to check them out.

Before you add any error handling code, the first thing to do is to try to prevent an error. If you declare an integer rather than a string and get an error, it makes no sence to add error code; just change dimention.

The most basic of all error handling code is the On Error statement. Generally, you'll put it at the beginning of the sub or function.
Reply With Quote
  #4  
Old 03-11-2002, 01:47 PM
Robby's Avatar
Robby Robby is offline
Code Factory

Retired Moderator
* Expert *
 
Join Date: Jan 2001
Location: Montreal, Ca.
Posts: 5,565
Default

What Orufet just said is the way to do it.

Just as a further tip, you should make sure that your code works
perfectly without any error handling. I put error handles in my
code, BUT, I comment them out during testing.
__________________
Visit...Bassic Software
Reply With Quote
  #5  
Old 03-11-2002, 02:12 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

No, you cant make a standard module to drop into any project and then take over all the error handling. Dont know where you thought you saw that.

If you insist on this then the closest you can get is to rely on the fact that VB passes all errors up the calling chain. However, this is useless for event-based programs.

__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->