bugs >> VB6 Raise Error w/ Custom Description being replaced w/ desc for e

by Um9iYg » Sat, 27 Jan 2007 02:37:01 GMT

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?

The same code works as I would expect on other XP machines in our shop.
--
Robb


bugs >> VB6 Raise Error w/ Custom Description being replaced w/ desc for e

by Ken Halter » Sat, 27 Jan 2007 02:46:58 GMT






This seems to work fine... note that you spelled "Raise" wrong above, which
means you're typing code from memory here... which is never a good idea.
It's always best to paste the actual code so we're not spinning our wheels
over a typo.
'====================
Option Explicit

Private Sub Command1_Click()
Dim o As Class1
Set o = New Class1
On Error Resume Next
Call o.TheError
Debug.Print Err.Number
Debug.Print Err.Source
Debug.Print Err.Description
End Sub
'====================
Option Explicit

Public Sub TheError()
Err.Raise 106, "MySource", "My Custom Description"
End Sub
'====================

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm





bugs >> VB6 Raise Error w/ Custom Description being replaced w/ desc for e

by Bob O`Bob » Sat, 27 Jan 2007 03:02:24 GMT





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
--


Similar Threads

1. VB6 Raise Error w/ Custom Description being replaced w/ desc f

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
> -- 
> 

2. Raising Custom Errors - VB.Net

3. [MULTIPOST] MSComm Error 8021 with desc.: "Application-defined or object-defined error"

4. MSComm Error 8021 with desc.: "Application-defined or object-defined error"