Coding event handlers

A

AMP

Sorry for my inexpieriance but all the event handlers I've programmed
were with visual components.
I need to write a handler for the
System.IO.Ports.SerialDataReceivedEventHandler

I have a SerialPort object already, but I'm lost as how to code this
event and wire it and get it to fire when data is received.
Thanks
Mike
 
S

S Kachru

static void Main()
{
SerialPort s = new SerialPort();
s.DataReceived += new SerialDataReceivedEventHandler(s_DataReceived);

}

static void s_DataReceived(object sender, SerialDataReceivedEventArgs
e)
{
throw new Exception("The method or operation is not implemented.");
}

If you are using VS 2005, you should be able to get this for free using the
intellisense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top