Compartir a través de


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

Tasks

Add Items Interactively to a List Box Sample

Display Pictures in a List Sample

Fill a List with Values from Different Sources Sample

Move Items Between List Boxes Sample

Multiselect Items in a List Box Sample

Open Multiple Files Interactively Sample

Sort List Box Items Sample

Treeview/Listbox Drag and Drop Sample

Other Resources

Controls Solution Samples