This function will help to remove all invisible characters in vb.net string
Public Function Remove(ByVal str As String) As String
Remove = str
Dim x As Long
' remove all non-printable characters
While InStr(Remove, vbCrLf) > 0
Remove = Replace(Remove, vbCrLf, String.Empty)
End While
While InStr(Remove, vbTab) > 0
Remove = Replace(Remove, vbTab, String.Empty)
End While
For x = 0 To 31
While InStr(Remove, Chr(x)) > 0
Remove = Replace(Remove, Chr(x), String.Empty)
End While
Next x
For x = 127 To 255
While InStr(Remove, Chr(x)) > 0
Remove = Replace(Remove, Chr(x), String.Empty)
End While
Next x
'Dim s = New String(" ", 2)
'While InStr(Remove, s) > 0
' Remove = Replace(Remove, s, " ")
'End While
End Function
Read more!