You might try the below code (not tested)
Dim str As String = ""
Dim i As Integer
' Loop through the characters in the text box
For i = 1 To RichTextBox1.TextLength
' Check the ascii values of the current character
' Note, an ascii value of 10 indicates enter
If Asc(Mid(RichTextBox1.Text, i, 1)) = 10 Then
' trim the string to remove trailing spaces
str = Trim(str) & vbCrLf
Else
str += Mid(RichTextBox1.Text, i, 1)
End If
Next i
RichTextBox1.Text = str
Thanks,
Seth
Paul wrote:
Hi,
My RichTextBox has multiple lines of text. Most of the lines unfortunately
end with a space.
Is it possible to replace the space and NewLine/Line Feed with just the
NewLine/LineFeed?
So in essence just removing the trailing space from each line?
Thanks,
Paul