UserGuide

Web List Box

From Xojo Documentation

A List Box displays a scrolling list of values in one or more columns.

You can change the number of columns of any List Box by changing the ColumnCount property in the Inspector.

Use the Initial Value property in the Inspector to add rows or change the headers of the List Box in the Layout Editor.

Commonly used events, properties and methods are listed below. Refer to WebListBox in the Language Reference for the complete list.

Events

SelectionChanged - Called when the row selection has changed.

Properties

SelectedRowColor - Used to specify the color of the selected row.

ColumnCount - Use to get or set the number of columns.

ColumnWidths - Used to set the width for all the columns.

HasHeader - When True, the List Box has a heading for each column.

SelecedRowIndex - Identifies the currently selected row.

RowCount - This is the total number of rows.

Methods

AddRow - Call this method to add a row (after the last row) and specify the values for the cells in the row.

CellValueAt - Used to get or set the values of a specific cell.

CellTagAt - Specifies a tag value for a specific cell. As it is a variant, a tag can contain any value.

RemoveAllRows - Removes all the rows from the List Box.

HeaderAt - If there is a heading, this property is used to specify the heading for a column.

AddRowAt - Adds a row at the specified position.

RemoveRowAt - Removes the specified row.

RowTagAt - Used to assign a tag value to the specified row.

Selected - Indicates if the specified row is selected.

Usage

This code adds 100 rows to a 5-column listbox:

For row As Integer = 1 To 100
Listbox1.AddRow("Col1", "Col2", "Col3", "Col4", "Col5")
Next

This code takes text entered in two Text Fields (FirstNameField and LastNameField) and adds it to a List Box:

// The WebListBox.AddRow method allows you to pass multiple parameters
// to add values to other columns of the new row
PeopleList.AddRow(FirstNameField.Value, LastNameField.Value)

Example Projects

These example project demonstrates features of the List Box:

  • Examples/Web/Controls/ListBoxExample
  • Examples/Sample Applications/EddiesElectronics/Web/EEWeb

See Also

WebListBox class