473,409 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

SerialPort: Adding an event handler error... "the specified function does not match the delegate type"

Hello all,

I would like to use the new SerialPort class in Visual C++ 2005
Express edition, but I am having problems adding my event handler to
the DataReceived event. In the header file I have the method that will
handle the event defined as

private: void SerialPortReceive_EventHandler( System::Object ^ sender,
System::IO::Ports::SerialDataReceivedEventArgs^ e );

In the cpp file the function is declared as

void CCommLayer::SerialPortReceive_EventHandler( System::Object^
sender, System::IO::Ports::SerialDataReceivedEventArgs^ e )
{
// Perform task here.
}
In the cpp file when the SerialPort is instantiated the following line
adds the method to the event delegate...

m_SerialPortCon->DataReceived += gcnew SerialDataReceivedEventHandler(
&CCommLayer::SerialPortReceive_EventHandler );
When I compile it I get the following error, but I don't know why..

..\CCommLayer.cpp(95) : error C3352: 'void
SDU::Comm::CCommLayer::SerialPortReceive_EventHand ler(System::Object
^,System::IO::Ports::SerialDataReceivedEventArgs ^)' : the specified
function does not match the delegate type 'void (System::Object
^,System::IO::Ports::SerialDataReceivedEventArgs ^)'
Any help is greatly appreciated... thanks

Mark

Nov 17 '05 #1
0 1102

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Dave Hammond | last post by:
I recently noticed the stylesheet link in an html page had the href set to a PHP script, as in: <LINK REL="stylesheet" href="some_css.php" type="text/css"> Presumably the file being referenced...
2
by: schneider | last post by:
How do I add the "xls:" to a XmlNode? I tried XmlDoc.CreateElement("xls: Value-of") I'm trying to create an element like the following: <xls: value-of select="SomeName" /> Thanks,
0
by: LordHog | last post by:
Hello all, I would like to use the new SerialPort class in Visual C++ 2005 Express edition, but I am having problems adding my event handler to the DataReceived event. In the header file I have...
1
by: Brad | last post by:
I'm trying to use Active Directory to retrieve information for a user...for display purposes.. I am not using windows authentication or impersonation....I am using a fixed user id and password for...
1
by: Elie | last post by:
Hello I get this error when the code runs from the server as an .asp page or from a compiled dll. But When I log onto the server and run a vb program that executes the same code, it works...
7
by: feng | last post by:
I need to test if the form is closing because of user's clicking on the "x" button, instead of other buttons, such as my "Exit" button, on my form. I would like to test this in my form's Closing...
17
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server...
3
by: Pierre Barbier de Reuille | last post by:
Hi, after reading the article " The Standard Librarian : Defining Iterators and Const Iterators" from Matt Austern:...
0
by: Curious | last post by:
Hi, I'm not sure if this is the right place to post such command issues. If you know a better forum where people respond to messages fairly often, please let me know! Anyway, would appreciate...
1
by: McKool | last post by:
Hello Group, I'm writting a Windows Services under C# to get some USB events. Because the ServiceBase class does not supports the SERVICE_CONTROL_DEVICEEVENT handler, I'm using P/Invoke to call...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...
0
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...

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.