Alignment Property

Applies To   See Also

Specifies the alignment of text associated with a control. Available at design time and run time.

Syntax

Control.Alignment[ = nAlign]

Settings

nAlign

For a CheckBox or OptionButton control, the settings for the Alignment property are:

Setting Description
0 (Default) Left. Aligns control to the left with text on the right.
1 (Default for Middle Eastern versions of Windows) Right. Aligns control to the right with text on the left.

For a ComboBox, EditBox, Header, Label, or Spinner control, the settings for the Alignment property are:

Setting Description
0 (Default) Left. Aligns text flush left. The default for combo boxes, edit boxes, headers, and labels.
1 (Default for Middle Eastern versions of Windows) Right. Aligns text flush right. The default for spinners.
2 Center. Aligns the text in the middle with equal spaces to the right and left.
3 Automatic. Aligns text based on the data type of the control source.

For a TextBox control, the settings for the Alignment property are:

Setting Description
0 Left. Aligns the text flush left.
1 Right. Aligns the text flush right.
2 Center. Aligns the text in the middle with equal spaces to the right and left.
3 (Default) Automatic. For a TextBox control not contained in a Column, aligns text based on the data type of the control source. Numeric types (numeric, double, float, currency, integer) are right-aligned; controls with other data types are left-aligned. For a TextBox control contained in a column, the Alignment setting for the column determines alignment of text in the text box.

For a column, the settings for the Alignment property are:

Setting Description
0 Middle Left. Aligns the text flush left and centers it vertically.
1 Middle Right. Aligns the text flush right and centers it vertically.
2 Middle Center. Aligns the text in the middle with equal spaces to the right and left and centers it vertically.
3 (Default) Automatic. Aligns text based on the data type of the control source. Numeric types (numeric, double, float, currency, integer) are right-aligned; controls with other data types are left-aligned.
4 Top Left. Aligns the text flush left at the top of the column.
5 Top Right. Aligns the text flush right at the top of the column.
6 Top Center. Aligns the text in the middle with equal spaces to the right and left, at the top of the column.
7 Bottom Left. Aligns the text flush left at the bottom of the column.
8 Bottom Right. Aligns the text flush right at the bottom of the column.
9 Bottom Center. Aligns the text in the middle with equal spaces to the right and left, at the bottom of the column.

Remarks

For a ComboBox, the Alignment property applies only when the Style property is set to 0.