Export (0) Print
Expand All

Visual Basic Reference

Visual Studio 6.0

WordWrap Property

See Also    Example    Applies To

Returns or sets a value indicating whether a Label control with its AutoSize property set to True expands vertically or horizontally to fit the text specified in its Caption property.


object.WordWrap [= boolean]

The WordWrap property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Boolean A Boolean expression specifying whether the Label expands to fit the text, as described in Settings.


The settings for boolean are:

Setting Description
True The text wraps; the Label control expands or contracts vertically to fit the text and the size of the font. The horizontal size doesn't change.
False (Default) The text doesn't wrap; the Label expands or contracts horizontally to fit the length of the text and vertically to fit the size of the font and the number of lines.


Use this property to determine how a Label control displays its contents. For example, a graph that changes dynamically might have a Label containing text that also changes. To maintain a constant horizontal size for the Label and allow for increasing or decreasing text, set the WordWrap and AutoSize properties to True.

If you want a Label control to expand only horizontally, set WordWrap to False. If you don't want the Label to change size, set AutoSize to False.

Note   If AutoSize is set to False, the text always wraps, regardless of the size of the Label control or the setting of the WordWrap property. This may obscure some text because the Label doesn't expand in any direction. 

If both AutoSize and WordWrap are set to True, text will wrap without increasing the size of the Label control, unless a single word is entered that is larger than the width of the Label. In that case, the AutoSize property takes priority and the width of the Label increases to accommodate the long word.

© 2014 Microsoft