G
Guest
Hi,
I try to use the ErrObject in one of my class Library. The class Library is
written in VB .NET and the dll should be used in a VB6 application or a VB
..NET application.
Here is a simple example of the code I wrote in .NET:
Public Class Class1
Public Sub test()
Err.Raise(777,,"test description", "test help link")
End Sub
Public Sub test2()
Err.Raise(888,,"test description2", "test help link2")
End Sub
Public Sub test3()
Err.Raise(999)
End Sub
End Class
And now here is my problem.
When I catch the error in .NET (using On Error), I have access to the
description and to the help file link. But, no matter what error number I
use, the program written in VB 6 always has the same error number.
This number is: -2146233088.
After googling it, I found a post which says that this is a COM error
exception: "managed code casting unhandled exception".
So, my question is: How do I use the number attribute of the ErrObject ?
Remark: when I use the Dll in VB .NET, I catch the correct number.
Thanks in advance for any help or any pointer.
For the record, here is a sample of a VB 6 code that I use to catch the error:
Private Sub Form_Load()
On Error GoTo there
MsgBox ("test")
Dim tst As ErrorVB6.Class1
Set tst = New Class1
tst.Test
there:
MsgBox (Err.Number & ":" & Err.Description & "-" & Err.HelpFile)
End Sub
I try to use the ErrObject in one of my class Library. The class Library is
written in VB .NET and the dll should be used in a VB6 application or a VB
..NET application.
Here is a simple example of the code I wrote in .NET:
Public Class Class1
Public Sub test()
Err.Raise(777,,"test description", "test help link")
End Sub
Public Sub test2()
Err.Raise(888,,"test description2", "test help link2")
End Sub
Public Sub test3()
Err.Raise(999)
End Sub
End Class
And now here is my problem.
When I catch the error in .NET (using On Error), I have access to the
description and to the help file link. But, no matter what error number I
use, the program written in VB 6 always has the same error number.
This number is: -2146233088.
After googling it, I found a post which says that this is a COM error
exception: "managed code casting unhandled exception".
So, my question is: How do I use the number attribute of the ErrObject ?
Remark: when I use the Dll in VB .NET, I catch the correct number.
Thanks in advance for any help or any pointer.
For the record, here is a sample of a VB 6 code that I use to catch the error:
Private Sub Form_Load()
On Error GoTo there
MsgBox ("test")
Dim tst As ErrorVB6.Class1
Set tst = New Class1
tst.Test
there:
MsgBox (Err.Number & ":" & Err.Description & "-" & Err.HelpFile)
End Sub