INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Visual Basic (Microsoft) Versions 5/6 FAQ

VB Programming Concepts

Error Handling Example by jlgdeveloper
Posted: 24 Aug 03

Please read the faq "Error Handling" by CasperTFG first, this is only meant as an additional note:

I use the "app.logEvent" call for the most part when handling errors. This writes a log to the application event viewer in the control panel.

Syntax:
=======
App.LogEvent vbCrLf & Err.Description & vbCrLf _
     & Err.Number & vbCrLf & App.EXEName & " your sub name"

Notes:
======
err.Description = the vb error description
err.Number = the error number
app.exename = the name of my program
vbCrlf = carraige return & line feed, to give me a new line
You can also add a number ie 1,2,3 to the call to indicate the severity of the error in the event viewer.

Example:
========
Sub nameOFSUB '*** could be a function
    on error goto errorhandler
    '*** code of the sub

    exit sub '*** could be a function
errorhandler:
    App.LogEvent vbCrLf & Err.Description & vbCrLf _
     & Err.Number & vbCrLf & App.EXEName & " your sub name here"    
     '***here use any of the following
     err.clear
     resume next
     '*** or your bail out code
End Sub
===========================
Jonathan Galpin MCSD +++ΒΌ
www.iqzero.net
because software should be easy to use

Back to Visual Basic (Microsoft) Versions 5/6 FAQ Index
Back to Visual Basic (Microsoft) Versions 5/6 Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close