Hi,
I have a text file on a remote server with this content:
-
Line1
Line2
Line3
...
-
I use this code to download it and put each line in a string (array)
It's OK, but when showing each line, the 1st line is OK.
After 2nd line, it applies a vbNewLine/vbCrLf to the beginning of each line.
And I CANNOT remove that, even with .Replace(vbNewLine, "")
How to remove this vbNewLine/vbCrLf from beginning of each line?
Thanks.
I have a text file on a remote server with this content:
-
Line1
Line2
Line3
...
-
I use this code to download it and put each line in a string (array)
Visual Basic:
Dim WebClient As New System.Net.WebClient
WebClient.Encoding = System.Text.Encoding.ASCII
WebClient.CachePolicy = New System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore)
Dim NewString As String = WebClient.DownloadString("http://www.domain.com/file.txt")
WebClient.Dispose()
Dim MyArray() As String = NewString.Split(vbNewLine)
For MyLoop As Integer = 0 To MyArray.Length - 1
MsgBox(MyArray(MyLoop).ToString.Replace(vbNewLine, ""))
Next
After 2nd line, it applies a vbNewLine/vbCrLf to the beginning of each line.
And I CANNOT remove that, even with .Replace(vbNewLine, "")
How to remove this vbNewLine/vbCrLf from beginning of each line?
Thanks.