OK the fix for that was:
Public Sub ErrorHandler(ByVal oErrObject As System.Object, ByVal cErrorType As String)
End Sub
Hi there,
Here is what I need to do. I have an Err handler routine that logs any error either from an
Exception or an SMTPException.
Within the Catch I call the Handler either for the SMTPException or the Exception. There 2 more properties
in the SMTPException that I need to log while they do no exists in the Exception.
In the err handler methods it starts like this:
Public Sub ErrorHandler(ByVal oErrObject As Object, ByVal cErrorType As String)
End Sub
So this way Either oibject could be picked up and I know which one is which based on the cErrorType,
But I am getting a little message saying as follows: System.InvalidCastException when I hover on top
of the oErrObject. It works fine otherwise.
The way I call the above is:
oInquiery.ErrorHandler(smtpEx, "SMTPErr")
Or
oInquiery.ErrorHandler(generalEx, "GeneralErr")
So any ideas?
Thanks,
Joe
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message news:BA**********************************@microsof t.com...
You cannot "upcast" a particular base class object to an instance of a more
specific object that derives from it. The base class ("Exception") has no
idea what the derived object may possibly be. Make sense?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"JoeP" wrote:
>Hi All,
Is that possible to convert an Exception object to SMTPException object. I
tried CType() and it did not work!
Thanks,
Joe