471,325 Members | 1,414 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Set flag in inherited class when SerialPort.DataReceived fires?

I've created MySerialPort, which inherits from SerialPort, and want to set an
internal flag when DataReceived is signalled. If I were firing the event
myself, it would be a simple matter of

flag = true;
if ( OnDataReceived != null) OnDataReceived();

The ugly way out is to create a public SetFlag() method and call it from the
DataReceived callback routine in the main program. Another alternative is to
poll for data myself and fire my own event, but that strikes me as both
redundant and wasteful. It seems there ought to be a better way to do this.
Any suggestions? Thanks.
Aug 29 '08 #1
0 943

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nathan Ie | last post: by
reply views Thread by no-one | last post: by
reply views Thread by Tony Kwong | last post: by
3 posts views Thread by Jamie Risk | last post: by
reply views Thread by rosydwin | last post: by

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.