Display Multiple Columns in a List Box Sample

File: ...\Samples\Solution\Controls\Lists\Lmulcol.scx

This sample demonstrates displaying multiple columns in a list box. The form displayed contains a list box and a spinner. The number of columns in the list box is set to the Value property of the spinner: 1, 2, 3, or 4.

To set the width of the columns in a multi-column list box, use the ColumnWidths property. For example, if there are 3 columns in the list box, the following command will set the column widths to 10, 15, and 20, respectively:

Form.List.ColumnWidths = "10, 15, 20"

To set the fields to be displayed in the columns, set the RowSource property. For example, the following command sets the sources of three columns in a 3-column list box to the contact, city, and country fields of the customer table:

Form.List.RowSource = "contact,city,country"

The ColumnLines property determines whether lines are displayed between the columns in the list.

See Also

Community Additions