0

hey...i got a problem..
Now i do the read text file line by line. I am using the ReadLine Function to do that. But It cannot show all the output. It always show the last one content in text file. It cannot show the previous content in text file to the text box. Who can help me to solve it...?
Thank you so much...

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by jonsca
0

StreamReader.ReadLine() reads one line at a time. If you want multiple lines you will have to loop through the data.
Or, depending on the program, you may be able to do the event multiple times reading one line of text each time.

0

Make sure the textbox is set to multiline.

To append your text to what is in the box, use the += operator.
In your loop: (obviously read the line of text into a temporary if you're using .ReadLine() to drive the loop)

myTextBox.Text +=(myStreamReader.ReadLine()+"\r\n");

I didn't test that out, but that's the gist of it

Edited by jonsca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.