Tools Links Login

A QUICK AND EASY ERROR HANDLER!!!!!

In just a few easy lines you can a have a easy, error proof error handler for you apps! Plus, NO APIs!

Original Author: Erik Hagendorn

Code

''''IN MODULE!''''
Sub ErrHandler
ErrDesc = Err.Description
ErrNum = Err.Number
Beep
MsgBox "Error number " & ErrNum & " has occured because: " &_
ErrDesc, vbCritical, "Error"
Exit Sub
'Edit the msgbox all ya want to make it fit your needs
End Sub
'Ok, now to make my error handler work you need to
'add this right under the Sub...Examle:
Private Sub Command1_Click ()
'Now Here Is the code you need to add:
On Error Goto ErrHandle:
'Then put ALL your code for this Sub in as you would
'as usual, then at the end type:
ErrHandle:
Call ErrHandler
'AND THATS IT!
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 98 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.