Columns Property

See AlsoT95GKO                 ExampleIZ8BT8>Low

Applies To

List boxG11UCK.

Description

Determines whether a list box scrolls vertically or horizontally.  If it scrolls horizontally, determines how many columns are displayed.

Usage

[form.]listbox.Columns

Setting

The Columns property settings are:

Setting             Description

 

0                     (Default) Items are arranged in a single column and the list box scrolls vertically.

1 to n              Items are arranged in snaking columns, filling the first column, then the second column, and so on.  The list box scrolls horizontally and displays the specified number of columns.

 

Remarks

For horizontal-scrolling list boxes, the column width is equal to the width of the list box divided by the number of columns.

This property can't be set to zero or changed from zero at run timethat is, you can't change a multi-column list box to a single-column list box, or a single-column list box to a multi-column list box, at run time.  However, you can change the number of columns in a multi-column list box at run time.

Data Type

IntegerDOKXHY


See Also

Help:

AddItem Method2BIX3OB

Grid Control2VGT0PT

List PropertyBKCX6E

ListCount Property4E91QN

ListIndex Property4K7KHR

RemoveItem MethodM867OS

TopIndex Property2EAX0Z

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"


Columns Property Example

The example illustrates how the two different kinds of list boxes work when they contain the same data.  To try this example, paste the code into the Declarations section of a form that contains two list boxes.  .Set  the Columns property to 2 for List2.  Then press F5 and click the form

Sub Form_Load ()
  Dim I                               ' Declare variable.
  List1.Move 50, 50, 2000, 1750       ' Arrange list boxes.
  List2.Move 2500, 50, 3000, 1750
  For I = 0 To Screen.FontCount -1    ' Fill both boxes with
    List1.AddItem Screen.Fonts(I)     ' names of screen fonts.
    List2.AddItem Screen.Fonts(I)
  Next I
End Sub