.NET class events handling in VB6

  • Thread starter Thread starter Leonardo Spina
  • Start date Start date
L

Leonardo Spina

I wrote a component using C# and I need to use it from a Visual Basic 6
client application.
The C# object raises an event which uses a custom delegate, but I don't know
how to catch the event in VB6.

Please help me!! ;-)
 
Leonardo,

If you use the TLBEXP utility, it should create a TLB that you can
import into VB6. Once you have that, you can declare your object with the
"WithEvents" modifier and you should be able to handle the object normally.

Of course, this is assuming that you are correctly attributing your
object so that it is suitable for COM interop.

Hope this helps.
 
I did it and it seems to work until I attempt to access the object (like I
try to call a method) when it says
"method T of object O failed" (error 80070002)

where "T" is not a method but the name of the instance of the .NET object
that I am accessing through COM Interop and "O" is the COM object "parent"
of my object "T"

what does it mean?



Nicholas Paldino said:
Leonardo,

If you use the TLBEXP utility, it should create a TLB that you can
import into VB6. Once you have that, you can declare your object with the
"WithEvents" modifier and you should be able to handle the object normally.

Of course, this is assuming that you are correctly attributing your
object so that it is suitable for COM interop.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Leonardo Spina said:
I wrote a component using C# and I need to use it from a Visual Basic 6
client application.
The C# object raises an event which uses a custom delegate, but I don't know
how to catch the event in VB6.

Please help me!! ;-)
 
Back
Top