View Single Post
  #1 (permalink)  
Old October 22nd, 2003, 08:46 PM
roy roy is offline
Registered User
Join Date: Sep 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Define events in COM built in .NET

Hi everyone.
I built in .NET a 'class library' project , which then I
compiled with "Register for COM interop".
I also added some events.

I use this component in VB6, but I can't hook up to the
Can someone please help?

In the .NET component's code, I tried to define events in
      2 different ways:
  public delegate void ClickedEventHandler(string val);
  public event ClickedEventHandler Clicked;
  and then...
  if(Clicked!=null) Clicked(txt.value);

2. [InterfaceTypeAttribute
    public interface IMonitorEvent
         void HandleMonitorEvent(bool IsEmergency);

Then, in order to hook up to those events in VB6:
1. I added a refernce in VB6 to the component.
2. I created instance
    Dim MyObj As ContainerForIE.Form1
    Set MyObj = CreateObject("ContainerForIE.Form1")
3. I tried to use
   "Public WithEvents MyObj As ContainerForIE.Form1"
   But it raises an error "Object does not source
   automation events"

Can anyone help please?

Reply With Quote