Results 1 to 3 of 3

Thread: Error Handling

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    British Columbia
    Posts
    1

    Error Handling

    OK, this is real simple, but for some reason it's not working for me.
    I just started playing around with VB6, and decided it was time to put some error checking in the code but.....

    I can't seem to raise the error "flag" so that I can trap an error.

    I even went so far as to create a new project with only a couple of lines in the Form-Load page.

    ie

    on error goto err_chk:
    err.raise 71

    err_chk:
    msgbox.....

    this doesn't work, I get the default error msg.

    I've stepped through, and sure enough, it's blowing up
    at the "err.raise" line.

    Is there something that I'm missing ????

    Thanx in advance

    GDR01

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Err.Raise is something that is used, typically, when creating an ActiveX object, or a component. Standard error trapping is the conventional method for handling errors in Standard VB projects.

  3. #3
    Si_the_geek
    Guest
    To force an error you should use the ERROR function, eg: " ERROR 23 " would cause error 23 to occur.

    err.raise forces the error to be sent to the calling sub/function etc, so should only be used when you don't want to handle the error within that sub.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width