RichtextBox and VBCrlf

TyB

Well-known member
Joined
May 14, 2009
Messages
102
Programming Experience
3-5
I have a program that has a Richtextbox that users will type a message in. The message is then sent to a form on another PC using TCP socket.

This all works find except that if the is a return character in the text that is sent it shows as a square character on the receiving form instead of creating a new line.

How do I check for this character? I tried using instr with VBCrlf as well as char(13) + char(10) on the string puled from the richtextbox before it is ever sent to the other form but it does not find the return character.

Thanks,

Ty
 
Hello.

For some reason (and I really don't know why) the RichTextBo is using a single Cr instead of CrLf. Just run a Replace(Convert.ToChar(13), Environment.NewLine) at the text before using it somewhere else.

Bobby
 
Got it

The issue turned out to be the the string is set with EncodeASCII.GetBytes and some how no matter what I looked for I could not figure out what it was changing the character to on the receiving side.

The solution was easy I was using a textbox on the receiving end instead of a richtextbox. I just replaced it with a richtextbox and no more issue.

Ty
 
Back
Top