Sam

Sam

  • NA
  • 166
  • 0

Error: No overload for matches delegate 'System.EventHandler'

Nov 15 2010 12:09 PM

Hello fellows,
I keep getting the error:
"No overload for 'comPort1_DataReceived' matches delegate 'System.EventHandler'"
Anyone knows what's wrong?
Thanks.
I have 2 methods reading from 2 serial ports.
I wish to have a watchdog timer that will activate the other port if a port does not get data within certain time.
(Normally, if data was received, it will reset the timer for each data cycle. If the timer does not resets (Stop) within certain time (no data), we open the other port).

Here is what I have: (in general terms...)
System.Windows.Forms.Timer wait= new System.Windows.Forms.Timer();
private void comPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
//some code
}

public void comPort2_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if wait.Interval> {do something} 
wait.Tick += new EventHandler(comPort1_DataReceived);
wait.Interval = 500;
wait.Start();
// Code
wait.Stop();
}

 


Answers (1)