Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Alignment Property
See Also Example Applies To
Returns or sets a value that determines the alignment of a CheckBox or OptionButton control, text in a control, or values in a column of a DataGrid control. Read-only at run time for CheckBox, OptionButton, and TextBox controls.
Syntax
object.Alignment [= number]
The Alignment property syntax has these parts:
| Part | Description |
| Object | An object expression that evaluates to an object in the Applies To list. |
| Number | An integer that specifies the type of alignment, as described in Settings. |
Settings
For CheckBox and OptionButton controls, the settings for number are:
| Constant | Setting | Description |
| VbLeftJustify | 0 | (Default) Text is left-aligned; control is right-aligned. |
| VbRightJustify | 1 | Text is right-aligned; control is left-aligned. |
For Label and TextBox controls, the settings for number are:
| Constant | Setting | Description |
| VbLeftJustify | 0 | (Default) Text is left-aligned. |
| VbRightJustify | 1 | Text is right-aligned. |
| VbCenter | 2 | Text is centered. |
For a DataGrid column, the settings for number are:
| Constant | Setting | Description |
| DbgLeft | 0 | Text is left-aligned. |
| DbgRight | 1 | Text is right-aligned. |
| DbgCenter | 2 | Text is centered. |
| DbgGeneral | 3 | (Default) General Text is left-aligned; numbers are right-aligned. |
Remarks
You can display text to the right or left of OptionButton and CheckBox controls. By default, text is left-aligned.
The MultiLine property in a Textbox control must be set to True for the Alignment property to work correctly. If the MultiLine property setting of a TextBox control is False, the Alignment property is ignored.