473,385 Members | 1,742 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,385 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 1864

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...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.