Formatted Output with Newline

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

if I type in the return character in a text box or richtext box, I do
not see the newline character in a string.
Scenario - I type 2 paragraphs in a text box. Visibly I can see the
information the windows form, but if I output the text in the textbox to
a string, and write the string to a file, I do not see that formatting.
Why not?

What do I need to do?

so sMyMessage = textbox1.text


where textbox1.text contains

"Hi my name is joe.

Yes, I had a happy holliday."


when a streamwriter is created, I do not see the lines between the first
and second line in the string file. Everything appears as continuous as
"Hi my name is joe. Yes, I had a happy holliday."

this is not what I want. I need things written to the file on separate
line. How do I fix it?
 
The question is how you wrote the text to the file.
With StreamWriter.Write(textBox1.Text), things should be on separate
lines.
If it does not work for you, pls post your code snippet.

Thi - http://thith.blogspot.com
 
Instead of
"StreamWriter.Write(textBox1.Text), things should be on separate
lines.
If it does not work for you, pls post your code snippet."

Dim sMyString as string
sMyString = trim(txtMyText.text)

where txtMyText.text = "Hi my name is joe.
what are you doing today? I had an icecream sandwich for lunch.

Every Day for lunch, I have an icecream sandwich."

streamwriter.writeline(sMyString)

I lose all of the formatting in this case. Why? things are presented
all as one piece of text. Continuously with only one space between
sentences.
 
I could not repro this. Does the problem happen with
Console.Write/MessageBox.Show?
How do you view the file to see the newline characters are lost? Try
view it with WordPad instead of NotePad and see if it the problem
persists?

Thi
 
Back
Top