Hard CR/LF wordwrap in textbox ??

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi all,

Is it possible to force a multiline textbox to insert a hard cr/lf when
wordwrapping ??

What I would like is to get a string array from the textbox representing
exactly how the text appears in the box.

ie if I type in "hello there everyone" and the textbox wraps it over 2
lines, I want to get an array containing the 2 strings..

"hello there"
"everyone"

Can this be done with a standard textbox ?? Or is there a function that can
take a string and wrap it to a specified length and return an array ??

thanks in advance
Steve
 
Cor Ligthert said:
Steve,

Strange, this is the normal behaviour in my opinion from a multiline
textbox.

A singleline sees it as one line while with a multiline it is usable with
lines and even processable as that.

http://msdn.microsoft.com/library/d...indowsformstextboxbaseclassmultilinetopic.asp

Hi Cor,

the textbox.lines property only splits the text into individual strings when
there are cr/lf characters typed by the user (ie they hit enter).

When the textbox wraps a long line onto second line, it does not add cr/lf
chars. When you check textbox.lines there is only one long string in the
array.
The wrapping is just done as it is displayed.

I would like to get a string array that represents exactly what the text
looks like in the box, after it has been wrapped.

thanks
Steve
 
Back
Top