tags:

views:

22

answers:

1

I have a class library that i made in C#.NET. The class has a public event, public event EventHandler DataReadyEvent; that is triggered periodically.

I have a VBA application that creates an instance of this Class Library using CreateObject(...). I can access the methods and properties of the class library easially through COM but I can't seem to get the events to work. Is it possible to trigger events through com? How do I listen for them in VBA?

A: 

By declaring a variable WithEvents:

Private WithEvents obj as ObjectType

Then use the edit window dropdowns to select first the obj, then available events for the obj. It'll create event handlers.

GSerg
I am not familiar with the edit window dropdowns. What is that?
Jordan S
They are between the text area and the window caption in an editor window. The left one is for selecting objects, the right one is for selecting relevant information about that object.
GSerg