Textbox ReadToEnd Bug

garykpa

New member
Joined
Sep 5, 2007
Messages
4
Programming Experience
10+
Has anyone experienced a problem when loading a text file to a textbox using the ReadToEnd method? I am consistantly experiencing a file truncation issue at 16,307 bytes when using method 1 below. I have switched to method 2, which reads the entire file into the textbox, but I would like to know why it is happening. Thanks in advance

Dim l_objLog As New StreamReader(l_sFileName)
'Method 1 (not working):
txtLog.Text = l_objLog.ReadToEnd

'Method 2:
Do Until l_objLog.EndOfStream
txtLog.AppendText(l_objLog.ReadLine & vbCrLf)
Loop
 
how about:
VB.NET:
Dim l_objLog As New StreamReader(l_sFileName)
'Method 1 (not working):
txtLog.Text = l_objLog.ReadToEnd
l_objLog.close()

?
 
I've never had issues with using ReadToEnd and then assigning it to a textbox. The only other thing I can think of is that you might not have MultiLine set to True on the TB
 
I don't believe I have.

You could try using a string variable that the ReadToEnd() sends the data, then assign the variable to the Text property

I can't find anything right now on any kind of file size limit when using the ReadToEnd method
 
Back
Top