suchanoob suchanoob - 1 year ago 186 Question

VB.NET: Convert multiline string into single line

I'm grabbing the HTML source code of a webpage and try to convert it to a single-line string but I can't.

This is my code:

Dim source As String = client.DownloadString("")
source = source.Replace(vbCrLf, "")

I also tried using Environment.NewLine and vbNewLine instead of vbCrLf but the result remains the same.

Rob Rob
Answer Source

Try this:

source = source.Replace(vbLf, "").Replace(vbCr, "")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download