This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Viewing Multiple Lines in the TextBox Control
By default, the Win Forms TextBox control displays a single line of text and does not display scroll bars. If the text is longer than the available space, only part of the text is visible.
To view multiple lines in the TextBox control
- Set the MultiLine property to True. If WordWrap is True (the default), then the text in the control will appear as one or more paragraphs; otherwise it will appear as a list, in which some lines may be clipped at the edge of the control.
- Set the ScrollBars property to an appropriate value.
- Use the default value, None, if the text will be a paragraph that almost always fits the control. The user can use the cursor to move around inside the control if the text is too long to display all at once.
- If you want to display a list of lines, some of which may be longer than the width of the TextBox control, choose Horizontal. If the list may be longer than the height of the control, choose Both.
- If you want to display one or more paragraphs of text, choose Vertical.
- Set the WordWrap property to an appropriate value.
- If you chose Horizontal scroll bars or Both, in order to display a list of lines, set WordWrap to false. Text in the control will not automatically be wrapped, so it will scroll to the right until a line break is reached.
- If you chose Vertical scroll bars or None, to display one or more paragraphs, set WordWrap to true (the default). When WordWrap is set to True, the horizontal scrollbar will not appear.
See Also
Controlling the Insertion Point in a TextBox Control | Creating a Password Text Box with the TextBox Control | Creating a Read-Only Text Box | Putting Quotation Marks in a String Programmatically | Selecting Text Programmatically in the TextBox Control | TextBox Control | Viewing Multiple Lines in the TextBox Control