ScrollBars Property (RichTextBox Control)

       

Returns or sets a value indicating whether a RichTextBox control has horizontal or vertical scroll bars. Read-only at run time.

Syntax

object.ScrollBars

The object placeholder represents an object expression that evaluates to a RichTextBox control.

Settings

The ScrollBars property settings are:

Constant Value Description
rtfNone 0 (Default) No scroll bars shown.
rtfHorizontal 1 Horizontal scroll bar only.
rtfVertical 2 Vertical scroll bar only.
rtfBoth 3 Both horizontal and vertical scroll bars shown.

Remarks

For a RichTextBox control with setting 1 (Horizontal), 2 (Vertical), or 3 (Both), you must set the MultiLine property to True.

At run time, the Microsoft Windows operating environment automatically implements a standard keyboard interface to allow navigation in RichTextBox controls with the arrow keys (UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW), the HOME and END keys, and so on.

Scroll bars are displayed only if the contents of the RichTextBox extend beyond the control's borders. If ScrollBars is set to False, the control won't have scroll bars, regardless of its contents.

A horizontal scrollbar will appear only when the RightMargin property is set to a value that is larger than the width of the control. (The value can also be equal to, or slightly smaller than the width of the control.)