Returns or sets a value that determines whether a ListBox control scrolls vertically or horizontally and how the items in the columns are displayed. If it scrolls horizontally, the Columns property determines how many columns are displayed.
Syntax
object.Columns [= number]
The Columns 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 how a control scrolls and how items are arranged in columns, as described in Settings. |
Settings
The settings for number are:
Setting | Description |
0 | (Default) Items are arranged in a single column and the ListBox scrolls vertically. |
1 to n | Items are arranged in snaking columns, filling the first column, then the second column, and so on. The ListBox scrolls horizontally and displays the specified number of columns. |
Remarks
For horizontal-scrolling ListBox controls, the column width is equal to the width of the ListBox divided by the number of columns.
This property can't be set to 0 or changed from 0 at run time — that is, you can't change a multiple-column ListBox to a single-column ListBox or a single-column ListBox to a multiple-column ListBox at run time. However, you can change the number of columns in a multiple-column ListBox at run time.