473,569 Members | 2,453 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.evCallOrigina tedEvent += new
M_COMLib._ImObj Events_evCallOr iginatedEventEv entHandler(evCa llOriginatedEve nt);

void evCallOriginate dEvent(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_evCallOrigina tedEvent( _
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.evCallOrigina tedEvent
Does C# require that all event handlers are in the format: void
evtHandler(obje ct sender, EventArgs e) ?

thank you,
KF

Apr 27 '07 #1
3 1422
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*********@gm ail.comwrote in message
news:11******** **************@ s33g2000prh.goo glegroups.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.evCallOrigina tedEvent += new
M_COMLib._ImObj Events_evCallOr iginatedEventEv entHandler(evCa llOriginatedEve nt);

void evCallOriginate dEvent(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_evCallOrigina tedEvent( _
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.evCallOrigina tedEvent
Does C# require that all event handlers are in the format: void
evtHandler(obje ct 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...@n othinks.comwrot e:
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...@gm ail.comwrote in message

news:11******** **************@ s33g2000prh.goo glegroups.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.evCallOrigina tedEvent += new
M_COMLib._ImObj Events_evCallOr iginatedEventEv entHandler(evCa llOriginatedEve *nt);
void evCallOriginate dEvent(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_evCallOrigina tedEvent( _
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.evCallOrigina tedEvent
Does C# require that all event handlers are in the format: void
evtHandler(obje ct 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*********@gm ail.comwrote in message
news:11******** *************@o 5g2000hsb.googl egroups.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...@n othinks.comwrot e:
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...@gm ail.comwrote in message

news:11******** **************@ s33g2000prh.goo glegroups.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.evCallOrigina tedEvent += new
M_COMLib._ImObj Events_evCallOr iginatedEventEv entHandler(evCa llOriginatedEve *nt);
void evCallOriginate dEvent(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_evCallOrigina tedEvent( _
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.evCallOrigina tedEvent
Does C# require that all event handlers are in the format: void
evtHandler(obje ct 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
2867
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 that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the...
4
2111
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 Datagrid in a Web Custom Control (WCC) : The datagrid has LinkButton Column which has a select LinkButton for each row. When this button is...
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 create the event handler for the CheckedChanged event. In addition, even if I manually create the event handler, the CheckedChanged event is never...
13
3490
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 following issues still exist. The article shows how to find methods on a receiver that match the pattern OnXXXX given the sender. It loops through...
5
1886
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) Save cmbMyCombo's event handler for SelectedIndexChange event. 2) Assign a temporary event handler sub to cmbMyCombo's for its SelectedIndexChange...
5
3824
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 class defining the eventargs I want to use: public class ApptEventArgs : EventArgs{ public int ApptUID; public String ApptOp;
6
8761
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 launches. I've wired up my event handler to each Menu item and toolbar button. (I use the same Event handler and I use the Tag property which is...
9
2460
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 post event will always execuate after the system is completed... - I want to wrap this functionality in a framework, so I could possibly have 3 or 4...
9
2810
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 the upper right dropdown and the IDE builds the sub. I am currently working on a project where the code behind is in C# and the above...
24
55098
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 EventHandler(Onbutton_click); I want to pass more information related that event. & want to use that
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.