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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbObject Error

Status
Not open for further replies.

skyplayer

Programmer
May 28, 2002
13
HK
According to MSDN, it said that it is better to add the vbObjectError to the err.number in the err.raise.
=======================================================
i.e. <Assume error occur, and on error goto E:>
E:
lngErrorNumber = err.number
err.raise vbObjectError + lngErrorNumber
=======================================================
However, I have some cascade classes that can propagate a error from a class to another class, if I still add the vbObjectError in another class, it will prompt overflow because vbObjectError+vbObjectError is larger than the range of the Long data type.
Therefore, I would like to ask can I omit the plus vbObjectError during err.raise?
=======================================================
e.g.
E:
lngErrorNumber = err.number
err.raise lngErrorNumber
=======================================================
Any side effect about this?
 
In MSDN Library, 'How to raise Errors' it is clear that vbObjectError isn't actually added, it's used a a bitmask in error processing and can be OR'ed.

So the answer is no you don't need to add it again. If you are doing it in some sort of generic module just use OR instead of +

It seems quite heavy, but i found that the article referred above is helpful Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top