473,390 Members | 1,301 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,390 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 1002

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nathan Ie | last post by:
Hi there! Not sure how many of you out there are familiar with the Serialport Class, but I'm trying to add an event handler for every time I receive new incoming data from the serial port by...
4
by: Ben Kim | last post by:
Hello all, Does anyone have an example on how to implement the new SerialPort Class in VB.NET? I have been able to create the class, send (.WriteLine) to the port and Read from the port but...
0
by: no-one | last post by:
Hi Guys, I am fairly new to Dot Net and I am trying to write a program that listens to the serial port and displays the string in a text box or listbox. I am using VS 2005 and framework 2.0 ...
0
by: Tony Kwong | last post by:
I am using my mobile phone as modem to send some SMS using modem AT commands and have the SerialPort.DataReceived to get the "reply" from the Port using "m_SerialPort.ReadExisting();" private...
5
by: herbert | last post by:
back in 1978 (!) the VAX/VMS serial line driver offered everything a developer needs to develop protocols of all kinds: - read x bytes - read to end of line - read to special character - read...
4
by: Jamie Risk | last post by:
I'm trying to implement a protocol that has a concept of a GAP timer in the serial stream; if two properly framed characters are spaced in time by so many milliseconds or longer, there is an...
3
by: Jamie Risk | last post by:
What thread does the DataReceived event run on? I'm preparing a design that uses the DataReceived event to stimulate a protocol state machine (PSM). The ambition is to have the serial process...
1
by: Haroon07 | last post by:
Hi, I have a class in C# which receives data from the socket and inherits from Form. Whenever it receives data, it fires an event. ReceivedDone += new...
2
by: RafaulWolf | last post by:
I have capture data from the serial port and save it in Access database using table adapter. I defined the serial port as a class so that I can use it dynamically as it require user to add multi...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.