Re: VB6 Raise Error w/ Custom Description being replaced w/ desc f

Tech-Archive recommends: Speed Up your PC by fixing your registry



According to MSDN, user-defined error numbers should start at
vbObjectError+513 (some very old pages incorrectly say '+512')

The vbObjectError constant is not an error code base. It's actually a bit
mask to apply to the user-defined numbers. VB's runtime reserves the first
512 codes as its own.

Tony Proctor

"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:evgQQOYQHHA.4832@xxxxxxxxxxxxxxxxxxxxxxx
Is there anything you can think of that differentiates the XP machine
you're
on from other machines where it works? Different language of Windows,
low-level apps & debuggers installed on that one that aren't on the
others,
anything of that nature?

Also, rather than using fixed numbers, you should use the vbObjectError
constant (e.g., Err.Raise vbObjectError + 1, "MySource", "My Custom
Description"), just to be absolutely safe. It doesn't sound like it'll
make
a difference here, but it's worth a try.

Finally, have a look at this article, it sounds awfully similar to what's
happening to you: http://support.microsoft.com/kb/238082/en-us. Of
lesser
relevance, I suspect, there's also
http://support.microsoft.com/kb/255625/en-us.



Rob (with one "b" <grin>)

"Robb" <Robb@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:68A0D10A-1CF4-48E7-97D3-1CEA935AC63E@xxxxxxxxxxxxxxxx
Mispellings aside, I changed my code to

Err.Raise 550, "MySource", "My Custom Description"

(copied and pasted this time) and I'm still getting the same results. I
got
550 from Help, it's in the user-defined range. The Error Number gets
passed
thru, the custom Description does not.

--
Robb


"Bob O`Bob" wrote:

Robb wrote:
I'm using VB 6.0, Service Pack 6, on an XP machine.

I'm raising an error with a custom Description in a DLL.

Err.Rasie 106,"MySource","My Custom Description"

When the invoking DLL catches the error the custom description has
been
replaced with the default VB description for the error number I
raised.
And
the Err.Source is blank.

Err.Number = 106
Err.Source = blank
Err.Description = Application-defined or Object-defined error

Any ideas as to why my "custom description" is being lost?


You can't pick just any number as if from a hat.

If you simply read the help entry for the Raise method, you'll see.




Bob
--





.