Replace a carriage return in a string

lkrterp

Member
Joined
Jul 10, 2007
Messages
21
Programming Experience
Beginner
Hi All!

I have an issue with a string where I pull the field from a table and the field is showing a return character, (shows as a little box).

I know how to replace quotes or other characters in a string....
NewStr = Trim(Replace(MyStr, "'", "''"))

Question is how do you replace a return or remove it from the string?

Thanks
 
Same way actually
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim s As String = "Hello there " & vbCrLf & " My name is Hack"
        MessageBox.Show(s)   'has the carriage return
        s = Replace(s, vbCrLf, "")
        MessageBox.Show(s) 'does not have the carriage return
End Sub
 
Back
Top