Columns

This property returns and sets a value that determines whether a ListBox control scrolls vertically or horizontally and how the items in the columns are displayed. If the Listbox control scrolls horizontally, the Columns property determines how many columns are displayed.

Syntax

object.Columns [= number]

Parameters

object
Object expression that evaluates to a ListBox control.
number
Integer that specifies how a control scrolls and how items are arranged in columns, as described in Settings.The following table describes the settings for number:
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 cannot be set to 0 or changed from 0 at run time—that is, you cannot 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.