Re: Error trapping

From: Russ Holsclaw (russ_at_holsclaw.nyet)
Date: 09/05/04


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.



Relevant Pages

  • Re: Error trapping
    ... >> All errors relating to the loading and displaying of the form ... >> that occour in routines of controls on the form like ... >Generally when you load a form, the program that does the loading ...
    (microsoft.public.vb.general.discussion)
  • Re: perl segfault - how to troubleshoot
    ... gdb `which perl` -c mythrename.pl ... Loading DB routines from perl5db.pl version 1.28 ...
    (comp.lang.perl.misc)
  • Re: Perl - approach to query https website for code & parsing xml response
    ... Here's my attempt against a live site (sourceforge), ... Loading DB routines from perl5db.pl version 1.28 ... Editor support available. ...
    (comp.lang.perl.misc)
  • Reading ENVI Images
    ... Does anyone have code I could use to read an ENVI image into matlab ... based on its header info? ... I have several different routines for ... loading specific things, but do not have a general utility. ...
    (comp.soft-sys.matlab)
  • Re: Next Version of GDI+ (maybe GDI+ 2.0)
    ... loading and manipulating of such files isn't lightning fast unless you have really powerfull dedicated hardware. ... to see whole image you need to read whole image, and then eventualy generate a smaller sample for display. ... BUT to have this smaler sample you need to load ALL the pixels of oryginal image. ...
    (microsoft.public.dotnet.framework.drawing)