Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Trapping Exception Errors
Mon, May 8 2006 4:17 AMPermanent Link

"Robin"
Hi,
 I have sucessfully vectored Application.OnException  to my Exception
handling routine.
This works fine and correctly traps all errors within my code.
It does not however trap the following error:
   A form is created, as part of normal startup where A table is open with
an invalid (or no) Database name
   This happens when the Database is located in a seperate DataModule and
not yet initialised.
Is there a way of trapping this within my exception handling routine ?
   cheers   Robin

Mon, May 8 2006 1:54 PMPermanent Link

Stuart Kelly
Hi Robin,

<< It does not however trap the following error:
A form is created, as part of normal startup where A table is open with an invalid (or no)
Database name
This happens when the Database is located in a seperate DataModule and not yet initialised. >>

My guess would be the creation order of the forms.
Where do you setup the Application.OnException?  Is it on your main form or part of the
DataModule?

--
Stuart Kelly
mode software
Tue, May 9 2006 1:22 PMPermanent Link

To prevent the error in the first place, in the project options, make sure
that the DataModule is earlier in the list of auto-created forms than the
main form.

--Bill Sparrow--
Wed, May 10 2006 8:26 AMPermanent Link

Dan Rootham
Robin,

Bill's advice is correct:
<< make sure that the DataModule is earlier in the list of auto-created forms
than the main form >>

One other trap to watch out for is any events on the data module which may fire
very early in the app's creation e.g. AfterScroll. You may need a flag to detect when
the app has completely initialised and the main form is ready, and until that flag is set True
you should skip the code in the AfterScroll or other event.

I got bitten by this a while ago, and it caused some puzzling AVs. Smiley

HTH,
Dan

Dan Rootham
Lexicon Software Ltd, Bath, UK
Image