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