Event handling (C# vs VB6.0)

  • Thread starter Thread starter Cowboy \(Gregory A. Beamer\)
  • Start date Start date
C

Cowboy \(Gregory A. Beamer\)

If you have it wrapped properly, you are most of the way there. In the
object declaration, add with Events (Dim with Events objectName as
TypeofWrapper). It is then a matter of matching the interface. You should
see the events on the COM wrapper and be able to bind to them.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
I have the following code in C# to "sink" an event with an event
handler.

Obj.OnCallEvent +=new CallEventHandler(obj_OnCallEvent);

obj_OnCallEvent being the actual method and "obj.OnCallEvent" is the
actual event.

This events are provided by a 3rd party Dll.

I have converted that dll into a type library and used it in VB6.0

However, I'm not sure how to "sink" events in VB6.0!

Please advise what would be a compatible statement in VB6.0 for above
C# code?
 
I have the following code in C# to "sink" an event with an event
handler.

Obj.OnCallEvent +=new CallEventHandler(obj_OnCallEvent);

obj_OnCallEvent being the actual method and "obj.OnCallEvent" is the
actual event.

This events are provided by a 3rd party Dll.

I have converted that dll into a type library and used it in VB6.0

However, I'm not sure how to "sink" events in VB6.0!

Please advise what would be a compatible statement in VB6.0 for above
C# code?

You'll need to have a class or form level variable declare WithEvents
(e.g. Dim WithEvents Obj as TargetObject). You'll then be able to write
a function called Obj_OnCallEvent (or similar) which handles the event.
This is assuming that the event is one that VB can hook up to - e.g.
that it is declared in a COM interface as an event (IIRC).

Damien
 
Back
Top