Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Readline doesn't read line feeds

Status
Not open for further replies.

jonnyknowsbest

Technical User
Feb 3, 2004
163
GB
I am trying to read in a textfile to a multiline text box, but when i run the code, it puts everything on to a single line in the textbox rather than on separate lines, as it appears in the text file.

Any ideas?
 
Linefeed characters are a line-breaker.
msdn said:
A line is defined as a sequence of characters followed by a carriage return (0x000d), a line feed (0x000a), Environment.NewLine, or the end of stream marker.
So when you read from your file the linefeed character gets stripped out.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Hi,

You could try something along the lines of

Code:
Dim reader as new StreamReader(fileName)
TextBox1.Text = reader.ReadToEnd
reader.Close

This will read in the entire text file, line feeds included. You'll need to get away from the ReadLine function at any rate. There are a couple of ways to do so.

Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top