Rich Text Box and Cr Lf

G

Guest

I have written a small terminal app that reads and writes to the serial port. In particular as the data is read from the serial port it is appended to the rich text box. The problem I am experiencing is this:

When CrLf is received in the same read and appended to the rich text box, it processes it by moving to the beginning of the next line. This is right.

When Cr is received at the end of one read it is appended to the rich text box. Then Lf is received at the beginning of the next read it is also appended to the rich text box. However, the rich text box appears to place a Lf with the Cr and then it receives the next Lf. The effect is that it skips down two lines instead of one. This incorrectly shows the data.

Is there anyway to overcome this?
 
G

Guest

I think replacing a CR by a CRLF is just a way of RichText trying to correct, what it thinks is a mistake.

One way is to check if the last char read is a CR and if so take it off the text added to the Rich Text. Then add the removed character to the next set of text that you read in. That should solve the problem of two CRLF.
 

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