LF & CR in Textbox

  • Thread starter Thread starter Armon Myrick
  • Start date Start date
A

Armon Myrick

The textbox will not goto next line when addindg a new string or VBCrLf.
All the lines are put on the first line of the textbox. I need to put a
textfile in the Textbox using streamreader. Wordwrap=false, multiline=True,
scrollbars = both. Sample code is included. Using it as a test bed.
References are correct.
Dim sr As StreamReader = New StreamReader("\storage
card\cncmgr\setting.txt")

Dim input As String

input = sr.ReadLine()

While Not input Is Nothing

TextBox1.Text = input + vbCrLf

input = sr.ReadLine()

End While

sr.Close()

A far as I can see, this should work.

Thanks for any help

A. Myrick
 
Hey Armon,

Curiously, you require /r/n. That is
o if there is such a thing you need vbLfCr
o or ^M^J (control-M control-J)
o or 0x000D 0x000A

Hope this helps,

Rod O.
 
Set TextBox.Multiline to True
The line terminator is VbCrLf (or "\r\n" in C#)
 
Armon said:
While Not input Is Nothing
TextBox1.Text = input + vbCrLf

The error is that you REPLACE the string in the text box.
Try this:
TextBox1.Text += input + vbCrLf
input = sr.ReadLine()
End While

Kind regards,

Benjamin Lukner
trinomix GmbH
 
One question? Wouldn't you exceed the max characters on a single line. I
can't have the wordwrap on because the text file is a code file for a CNC
machine and each line is specific and has to be on it's own line.
 
Back
Top