473,507 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event Handler help

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
3 1420
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2849
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
4
2108
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
1
329
by: Richard W | last post by:
I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to...
13
3478
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
5
1875
by: Richard Grant | last post by:
Hi, I need to "save" in a variable the event handler sub of a control's event, then perform some process, and finally "restore" the originally saved event handler. Example in pseudo-code: 1)...
5
3820
by: james | last post by:
Hello, I am having a little trouble creating an event handler for a context menu toolstripmenuitem. I've seen various tutorials and so on, but I keep getting a bit stuck! So far I have a second...
6
8754
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
9
2456
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
9
2805
by: AG | last post by:
Using VS 2005. Usually I work in VB.NET. In code behind when I need to add code to an event, I just select the object in the upper left dropdown of the code window and then the desired event in...
24
55033
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.