G
Guest
I created a COM+ component and I need to pass an event to the client app.
Here is my scenario.
I have this component that checks if a product number is valid
.....................
Public Class ProductChecker
Protected WithEvents myOtherCompoent As new OtherComponent
...............
Public Function IsProductValid(sProdID as string) As Boolean Implements
IProdChecker.IsProductValid
Try
With myOtherCompoent
..ProdID = sProdID
..ValidateProduct
End With
Return True
Catch ex As OtherComponent.Exception
End Try
End Function
End Class
When a client calls this component it returns true if product is valid. This
component basically calls the .ValidateProduct from another .dll
(OtherComponent.dll) but this is the problem. The other .dll
(OtherComponent.dll) raises an exception if the product is invalid and I need
to also pass that exception message back to the client. At the moment I can
catch the exception in Catch ex As OtherComponent.Exception but how do I pass
it to the client. I tried
Catch ex As OtherComponent.Exception
Return ex.message
but I got an error because the function that initiates the error (Public
Function IsProductValid) returns type Boolean. Any ideas?
Basically the component should return True if product is valid of false if
invalid alsong with reason (exceptions returned buy other dll) as well.
Thanks
Here is my scenario.
I have this component that checks if a product number is valid
.....................
Public Class ProductChecker
Protected WithEvents myOtherCompoent As new OtherComponent
...............
Public Function IsProductValid(sProdID as string) As Boolean Implements
IProdChecker.IsProductValid
Try
With myOtherCompoent
..ProdID = sProdID
..ValidateProduct
End With
Return True
Catch ex As OtherComponent.Exception
End Try
End Function
End Class
When a client calls this component it returns true if product is valid. This
component basically calls the .ValidateProduct from another .dll
(OtherComponent.dll) but this is the problem. The other .dll
(OtherComponent.dll) raises an exception if the product is invalid and I need
to also pass that exception message back to the client. At the moment I can
catch the exception in Catch ex As OtherComponent.Exception but how do I pass
it to the client. I tried
Catch ex As OtherComponent.Exception
Return ex.message
but I got an error because the function that initiates the error (Public
Function IsProductValid) returns type Boolean. Any ideas?
Basically the component should return True if product is valid of false if
invalid alsong with reason (exceptions returned buy other dll) as well.
Thanks