0

How to break new line if text longer than textBox in c#. Because when I try count the character and than break it is not useful. What is my system When I write the text into the TextBox if the text longer than TextBox I want it to break and Enter new line the result should be under form below

Result should be like this in c#:

  ______________________________________
 |                                      |
 |GOOD MORNING EVERY ONE CAN YOU HELP ME|I HAVE A GIB PROBLEM PLEASE TELL ME......
 |______________________________________|


[ button ]

The result should be:

-  GOOD MORNING EVERY ONE CAN YOU HELP ME
-  I HAVE A GIB PROBLEM PLEASE TELL ME......
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    This only works for multi line (aka "Text area") text boxes. To make it _look_ like a single line at first sight, use a ["Text area auto height" solution](http://stackoverflow.com/questions/17772260/textarea-auto-height). – Uwe Keim Jul 01 '14 at 08:26

3 Answers3

2

There are Wrap or WrapText option. You should set it to true. EDIT: And set the TextMode to TextBoxMode.Multiline.

1

You should set WrapText Option of TextBox to True.

Also set TextMode property to TextBoxMode.MultiLine. (Thanks to Uwe Comment on my answer).

Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
0

Set WrapText Option of TextBox to True, and set the TextMode to TextBoxMode.Multiline.

Immortal Blue
  • 1,691
  • 13
  • 27