Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Capturing events within a class


Message #1 by "Mark Phillips" <mark@p...> on Thu, 9 Jan 2003 19:37:35
This is how your class should be like:

---------------------
private withevents m_obj as NameOfTheComponent

public property set ComponentObject(obj as NameOfTheComponent)
    set m_obj = obj
end property

private sub m_obj_OnEvent() '' any event the component fires
end sub
--------------------

Declare the class in you form and assign the ComponentObject
property, and you are set. This is a very common tecnique in VB.
BTW: you cannot do this if the component is part of an arry.

If you are already doing this, then something is wrong with
that particular component.

Marco


> I have a commercial ActiveX control. I want to wrap my own class around 
t> his control. How can I respond to the events that this control 
generates 
w> ithin my class? I only seem to be able to get the events on the form 
that 
c> ontains the control.

> Thanks!

> Mark

  Return to Index