Export (0) Print
Expand All

MaskedTextBox.TextAlign Property

Gets or sets how text is aligned in a masked text box control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
public HorizontalAlignment TextAlign { get; set; }
/** @property */
public HorizontalAlignment get_TextAlign ()

/** @property */
public void set_TextAlign (HorizontalAlignment value)

public function get TextAlign () : HorizontalAlignment

public function set TextAlign (value : HorizontalAlignment)

Not applicable.

Property Value

One of the HorizontalAlignment enumeration values that specifies how text is aligned relative to the control. The default is Left.

Exception typeCondition

InvalidEnumArgumentException

The value assigned to this property is not of type HorizontalAlignment.

You can use the TextAlign property to align the displayed text within a MaskedTextBox to match the layout of visual elements on your form. For example, if your controls are all located on the right side of the form, you can set the TextAlign property to Right, and the text will be aligned with the right side of the control instead of the default left alignment.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft