By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,754 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

Event Handler help

P: n/a
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_evCallOriginatedEventEventHa ndler(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

Apr 27 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

<ke*********@gmail.comwrote in message
news:11**********************@s33g2000prh.googlegr oups.com...
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_evCallOriginatedEventEventHa ndler(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

Apr 27 '07 #2

P: n/a
And this method signature matches its delegate. The signature was even
automatically generated by intellisense....

On Apr 27, 5:50 pm, "Kevin Spencer" <unclechut...@nothinks.comwrote:
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

<kevinfor...@gmail.comwrote in message

news:11**********************@s33g2000prh.googlegr oups.com...
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_evCallOriginatedEventEventHa ndler(evCallOriginatedEve*nt);
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- Hide quoted text -

- Show quoted text -

Apr 27 '07 #3

P: n/a
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

<ke*********@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
And this method signature matches its delegate. The signature was even
automatically generated by intellisense....

On Apr 27, 5:50 pm, "Kevin Spencer" <unclechut...@nothinks.comwrote:
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

<kevinfor...@gmail.comwrote in message

news:11**********************@s33g2000prh.googlegr oups.com...
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_evCallOriginatedEventEventHa ndler(evCallOriginatedEve*nt);
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- Hide quoted text -

- Show quoted text -


Apr 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.