Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to raise error from VB to VC

Status
Not open for further replies.

raman258

Programmer
Oct 17, 2005
1
US
Hi fellow group members,

GoodMorning.

I want to send a specific error from my VB component(server) to a VC component(client) using err.raise method. But, I am not able see the value in hr(HRESULT) of VC. Please advise.

Sample code in VB:
Private sub IF1_Method1()
On Error Resume Next
Call Mathod2
If Err.Number < 0 Then 'if it is error
'send my error
Err.Raise 1000+vbObjectError
Exit sub
End If
End sub

Sample code in VC
hr = pIF1->Method1()

Here “hr” is always found to be “zero” though I make sure to send an error from VB.


 
As far as I know, you won't be able to, since err.raise only sets values in an internal Err object for VB, which object isn't exposed via COM. Some recommendations are to make the error into a property, to raise an event, and so on. I believe there's a way to make an error visible to a C HR, but I'm not sure how. You might repost this to the VB5 and 5 forum, where there are people who know the API very well.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top