Click here to Skip to main content
15,887,812 members
Home / Discussions / C#
   

C#

 
QuestionReading from serial port Pin
alfie.max1524-Oct-13 7:39
alfie.max1524-Oct-13 7:39 
AnswerRe: Reading from serial port Pin
jschell24-Oct-13 7:57
jschell24-Oct-13 7:57 
GeneralRe: Reading from serial port Pin
alfie.max1524-Oct-13 8:18
alfie.max1524-Oct-13 8:18 
AnswerRe: Reading from serial port Pin
OriginalGriff24-Oct-13 8:08
mveOriginalGriff24-Oct-13 8:08 
GeneralRe: Reading from serial port Pin
alfie.max1524-Oct-13 8:58
alfie.max1524-Oct-13 8:58 
GeneralRe: Reading from serial port Pin
OriginalGriff24-Oct-13 9:07
mveOriginalGriff24-Oct-13 9:07 
GeneralRe: Reading from serial port Pin
alfie.max1524-Oct-13 9:13
alfie.max1524-Oct-13 9:13 
AnswerRe: Reading from serial port Pin
OriginalGriff24-Oct-13 9:51
mveOriginalGriff24-Oct-13 9:51 
Um.
You do realize that each time you click the "Start" button, you add another handler to the existing list? So when a character arrives, the same handler method will be called twice, then three times, then four, etc...

And that DataReceived is likely to be called each time a character arrives, since your PC runs rather faster than the serial port does, most of the time?

How I would start:
Add the handler once, when you first construct the SerialPort instance.
Add a bool to enable / disable receive.
When you press the Start button, clear the text from the RTB, then set the bool to enabled.
When you press the Stop button, set the bool to disabled.
In the DataReceived Handler, read the data available. Then, check the bool. If it is enabled, Append the data to the RTB and scroll to the caret. (You shouldn't need an invoke, I don't think). Do not clear the RTB.
If it is disabled, throw the data away!

Try that...
The only instant messaging I do involves my middle finger.

English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

GeneralRe: Reading from serial port Pin
alfie.max1524-Oct-13 19:12
alfie.max1524-Oct-13 19:12 
GeneralRe: Reading from serial port Pin
OriginalGriff24-Oct-13 21:50
mveOriginalGriff24-Oct-13 21:50 
GeneralRe: Reading from serial port Pin
alfie.max1525-Oct-13 1:30
alfie.max1525-Oct-13 1:30 
AnswerRe: Reading from serial port Pin
PIEBALDconsult24-Oct-13 17:32
mvePIEBALDconsult24-Oct-13 17:32 
QuestionI need help with control inheritance Pin
deebow24-Oct-13 4:39
deebow24-Oct-13 4:39 
AnswerRe: I need help with control inheritance Pin
OriginalGriff24-Oct-13 5:02
mveOriginalGriff24-Oct-13 5:02 
GeneralRe: I need help with control inheritance Pin
BillWoodruff24-Oct-13 6:07
professionalBillWoodruff24-Oct-13 6:07 
AnswerRe: I need help with control inheritance Pin
BillWoodruff24-Oct-13 6:02
professionalBillWoodruff24-Oct-13 6:02 
GeneralRe: I need help with control inheritance Pin
OriginalGriff24-Oct-13 6:25
mveOriginalGriff24-Oct-13 6:25 
GeneralRe: I need help with control inheritance Pin
deebow24-Oct-13 6:44
deebow24-Oct-13 6:44 
GeneralRe: I need help with control inheritance Pin
BillWoodruff24-Oct-13 16:56
professionalBillWoodruff24-Oct-13 16:56 
Questionhow to create stetmen foreach gridcontrol devexpress Pin
Member 1027082523-Oct-13 23:19
Member 1027082523-Oct-13 23:19 
QuestionRe: how to create stetmen foreach gridcontrol devexpress Pin
Richard MacCutchan23-Oct-13 23:27
mveRichard MacCutchan23-Oct-13 23:27 
AnswerRe: how to create stetmen foreach gridcontrol devexpress Pin
OriginalGriff23-Oct-13 23:54
mveOriginalGriff23-Oct-13 23:54 
AnswerRe: how to create stetmen foreach gridcontrol devexpress Pin
Eddy Vluggen24-Oct-13 0:30
professionalEddy Vluggen24-Oct-13 0:30 
QuestionRoulette wheel selection Pin
Member 995886723-Oct-13 17:16
Member 995886723-Oct-13 17:16 
AnswerRe: Roulette wheel selection Pin
Abhinav S23-Oct-13 20:24
Abhinav S23-Oct-13 20:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.