NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TextBox.ScrollBars

Gets or sets which scroll bars should appear in a multiline TextBox control.

[Visual Basic]
Public Property ScrollBars As ScrollBars
[C#]
public ScrollBars ScrollBars {get; set;}
[C++]
public: __property ScrollBars get_ScrollBars();
public: __property void set_ScrollBars(ScrollBars);
[JScript]
public function get ScrollBars() : ScrollBars;
public function set ScrollBars(ScrollBars);

Property Value

A ScrollBars that indicates whether a multiline text box control appears with no scroll bars, a horizontal scroll bar, a vertical scroll bar, or both. The default is ScrollBars.None.

Remarks

Horizontal scroll bars will not be shown if the WordWrap property is set to true, regardless of the value of the ScrollBars property.

Example [Visual Basic]

The following example creates a multiline TextBox control with vertical scroll bars. This example also uses the AcceptsTab, AcceptsReturn, and WordWrap properties to make the multiline text box control useful for creating text documents.

[Visual Basic]

Public Sub CreateMultilineTextBox()
   ' Create an instance of an TextBox control.
   Dim Text1 as TextBox
   Set Text1 = New TextBox()
   
   ' Set the Multiline property to True.
   Text1.Multiline = True
   ' Add vertical scroll bars to the TextBox control.
   Text1.Scrollbars = ScrollBars.Vertical
   ' Allow the RETURN key in the TextBox control.
   Text1.AcceptsReturn = True
   ' Allow the TAB key to be entered in the TextBox control.
   Text1.AcceptsTab = True
   ' Set WordWrap to True to allow text to wrap to the next line.
   Text1.WordWrap = True
   ' Set the default text of the control.
   Text1.Text = "Welcome!"
End Sub

See Also

TextBox Class | TextBox Members | System.WinForms Namespace | ScrollBars