JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Adding Scroll Bars to Text Boxes

How do you add scroll bars to text boxes? You use the text box's ScrollBars property instead of using actual scroll bar controls, but I'm including this topic here anyway because this is a natural chapter to turn to with this question.

First, make sure the text box's MultiLine property is set to True, because only multiline text boxes support scroll bars. Next, decide what kind of scroll bars you want on the text box: horizontal, vertical, or both, and set the ScrollBars property to match. That property can take these values from the ScrollBars enumeration:

  • None—(the default) No scroll bars

  • Horizontal

  • Vertical

  • Both

For example, I've added both horizontal and vertical scroll bars to the text box in Figure 8.10; note that the bottom scroll bar will appear only if you've set the WordWrap property to False.

Figure 8.10: Adding scroll bars to a text box.
Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor