Re: Error trapping
From: Russ Holsclaw (russ_at_holsclaw.nyet)
Date: 09/05/04
- Next message: alpine: "Re: Dictionary Object and FSO versions"
- Previous message: Jezebel: "Re: Dictionary Object and FSO versions"
- In reply to: Peter: "Error trapping"
- Next in thread: Stan Hilliard: "Re: Error trapping"
- Reply: Stan Hilliard: "Re: Error trapping"
- Reply: Tony Proctor: "Re: Error trapping"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 5 Sep 2004 16:23:19 -0600
> if I do something like this:
>
> on error goto errhandler
> Form1.show
>
> What errors will be catched?
> All errors relating to the loading and displaying of the form
or even errors
> that occour in routines of controls on the form like
command1_click?
The effect of an On Error is limited to errors that are raised in
the procedure that contains it, or in procedures that it calls.
Generally when you load a form, the program that does the loading
usually finishes executing before anything else happens in the
form's procedures.
I would have expected, therefore, that maybe if the form were
shown modally, that unhandled errors in the form might be raised
back in the procedure that showed the form. However, that doesn't
seem to be the case.
I tried this experimentally, and the error handler in the routine
that contain the "form2.show vbModal" statement didn't get
invoked when an error in the form was raised.
So, it appears that each form needs to handle its own errors.
My own preferred style of programming, however, never really runs
into that situation. I generally let the "Load" and "show"
actions of a form happen within that form's own methods, rather
than those of an external form. That's just because I like to
make the showing, loading, and unloading of a form, as well as
handling the contents and events of the form, the responsibility
of the form module itself, so as to more fully "encapsulate" the
form as an object, as seen by other parts of the program.
- Next message: alpine: "Re: Dictionary Object and FSO versions"
- Previous message: Jezebel: "Re: Dictionary Object and FSO versions"
- In reply to: Peter: "Error trapping"
- Next in thread: Stan Hilliard: "Re: Error trapping"
- Reply: Stan Hilliard: "Re: Error trapping"
- Reply: Tony Proctor: "Re: Error trapping"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|