COM Object Events

L

Lou

I have a COM obejct I have added a sa reference to my project.
How do I utilize the events of this COM object.
I am a VB programmer and to do this in VB is
Dim WithEvents myOb as myCOMObject

How is this done in C#?

-Lou
 
F

Family Tree Mike

Lou said:
I have a COM obejct I have added a sa reference to my project.
How do I utilize the events of this COM object.
I am a VB programmer and to do this in VB is
Dim WithEvents myOb as myCOMObject

How is this done in C#?

-Lou


You don't need to explicitly declare that the object has events in C# as you
did in vb.net. Your declaration in C# would look like:

myCOMObject myOb;

To declare an event handler for this object, in your routine you would have
a line such as:

myOb.AnEvent += new System.EventHandler(AnEvent_Handler);
 
L

Lou

Thanks..
That worked.


Family Tree Mike said:
You don't need to explicitly declare that the object has events in C# as
you did in vb.net. Your declaration in C# would look like:

myCOMObject myOb;

To declare an event handler for this object, in your routine you would
have a line such as:

myOb.AnEvent += new System.EventHandler(AnEvent_Handler);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top