Click here to Skip to main content
15,894,955 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, i am reading a text file in a loop into my rich text box.
I want to add a separator line after each line of text.

VB
Dim URL As String = strChatSite & "/File.txt"
      Dim request As WebRequest = WebRequest.Create(URL)
      Dim response As WebResponse = request.GetResponse()
      Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
      txtC.Text = reader.ReadToEnd



How can i do that in a rich text box?

Thanks
Posted

1 solution

You have to go through the entire stream and parse it up into individual lines. Depending on the line break character(s) that are in the .txt file, you may just get away with ReadToEnd the entire stream into a String variable, then just call Replace on it with and replace the line break character(s) with Environment.NewLine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900