Event Handler help

K

kevinforbes

Hi All,

I'm a little rusty on my C# so any help would be much appreciated.

..net 2.0, C#, using a COM object with events

I have a COM object (built in C++) that throws various telephony
events with a signature as follows:

o.evCallOriginatedEvent += new
M_COMLib._ImObjEvents_evCallOriginatedEventEventHandler(evCallOriginatedEvent);

void evCallOriginatedEvent(int hMonitorObj, int state, int cause, int
callId, int evNumber, string evTime, int workTimer)

the following code works fine in VB.NET apps i have done, but the
above C# code is not working for me, am i missing something?

VB.NET CODE:
Private Sub M_evCallOriginatedEvent( _
ByVal hMonitorObj As Integer, _
ByVal state As Integer, _
ByVal cause As Integer, _
ByVal callId As Integer, _
ByVal evNumber As Integer, _
ByVal evTime As String, _
ByVal workTimer As Integer) _
Handles m.evCallOriginatedEvent


Does C# require that all event handlers are in the format: void
evtHandler(object sender, EventArgs e) ?

thank you,
KF
 
K

Kevin Spencer

All Event Handler method signatures must match the method signatures of the
delegates they are designed for.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
K

kevinforbes

And this method signature matches its delegate. The signature was even
automatically generated by intellisense....
 
K

Kevin Spencer

I'd have to see all of the relevant code in order to diagnose the problem.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

And this method signature matches its delegate. The signature was even
automatically generated by intellisense....
 

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