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

Raising custom errors

Status
Not open for further replies.

pokasick

Programmer
Oct 29, 2001
17
US
VB help says "to generate the error number 513, assign vbObjectError + 513 to the Number property". When I raise an error in this manner, then display the number in a message box in an error handler, the error number is -2147220991.

Shouldn't the number displayed in the message box be 513? That's what I was hoping for.

It seems strange to me that the error number is supposed to be a whole number between 0 and 65,535, but the vbObjectError constant equals -2147221504. I don't understand how adding 513 to the vbObjectError produces an error number 513.

Can someone help me out with this?

Thanks,
Paul

 
vbObjectError has the value of hex 0x80040000. This is for proper COM error detection (requiring a negative value).

You can just raise the error 513, it just won't be listed as an "automation" error, but can still be used to trap errors in calling functions, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top