
04-02-2012, 10:26 AM
|
Freshman
|
|
Join Date: Apr 2010
Posts: 45
|
|
vbNewLine or VbCrLf Problem
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)
Code:
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
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.
|
|