For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > December 2005 > Under what circumstances is the Err object reset?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Under what circumstances is the Err object reset?
Frank Rizzo

2005-12-15, 6:55 pm

I am loosing the contents of the Err object as I catch (and rethrow)
these exceptions going up the function chain. Somewhere along the line
the data in the Err object is lost and the custom error number is
converted to error 5. Under what circumstances would the error be reset?

Thanks.
Frank Rizzo

2005-12-15, 6:55 pm

Frank Rizzo wrote:
> I am loosing the contents of the Err object as I catch (and rethrow)
> these exceptions going up the function chain. Somewhere along the line
> the data in the Err object is lost and the custom error number is
> converted to error 5. Under what circumstances would the error be reset?
>
> Thanks.


I should point out that it works great in the IDE, but not as an
executable. Why in the world would that happen?

Ken Halter

2005-12-15, 6:55 pm

"Frank Rizzo" <none@none.com> wrote in message
news:eNROgSaAGHA.2812@TK2MSFTNGP09.phx.gbl...
>I am loosing the contents of the Err object as I catch (and rethrow) these
>exceptions going up the function chain. Somewhere along the line the data
>in the Err object is lost and the custom error number is converted to error
>5. Under what circumstances would the error be reset?
>
> Thanks.


Any use of 'On Error' will reset the object.

Help says.....


"Err Object

<section snipped>

The Err object's properties are reset to zero or zero-length strings ("")
after an Exit Sub, Exit Function, Exit Property or Resume Next statement
within an error-handling routine. Using any form of the Resume statement
outside of an error-handling routine will not reset the Err object's
properties. The Clear method can be used to explicitly reset Err."

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm


Tony Proctor

2005-12-15, 6:55 pm

Also, the Err object is a different one for each project. Hence, if you
called across a DLL interface then you would see a different Err object on
the other side. Is your application a single project, or were you debugging
a project group in the IDE Frank?

Tony Proctor

"Frank Rizzo" <none@none.com> wrote in message
news:eNROgSaAGHA.2812@TK2MSFTNGP09.phx.gbl...
> I am loosing the contents of the Err object as I catch (and rethrow)
> these exceptions going up the function chain. Somewhere along the line
> the data in the Err object is lost and the custom error number is
> converted to error 5. Under what circumstances would the error be reset?
>
> Thanks.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com