From Xojo Documentation

For desktop applications, see ListBox.

Class (inherits from WebControl)

A scrollable, multicolumn listbox control that is similar to the desktop Listbox control.

CellClick Hidden MouseUp
Close KeyPressed Open
ContextualMenuAction MouseDown Resized
DoubleClick MouseEnter SelectionChanged
DropObject MouseExit Shown
HeaderPressed MouseMove

AlternateRowColor Height Name fa-lock-32.png
CellTag HelpTag Page fa-lock-32.png
ColumnCount HorizontalCenter Parent fa-lock-32.png
ColumnHeaderStyle LastIndex fa-lock-32.png PrimaryRowColor
ColumnWidth Left RowCount
ColumnWidths List RowHeight fa-lock-32.png
ContextualMenu ListIndex SelectionStyle
ControlID fa-lock-32.png LockBottom Style
Cursor LockHorizontal Top
DataSource LockLeft VerticalCenter
DragOverStyle LockRight Visible
Enabled LockTop Width
HasHeading LockVertical Zindex
HeaderStyle MinimumRowHeight
Heading MultiLine

AcceptPictureDrop CellPicture PresentContextualMenu
AcceptRawDataDrop CellStyle RemoveRow
AcceptTextDrop Close RowTag
AddRow ColumnStyle ScrollTo
AllowPictureDrag DeleteAllRows Selected
AllowRawDataDrag ExecuteJavaScript SetFocus
AllowTextDrag InsertRow ShowURL
Cell MsgBox


The WebListBox provides many of the features of the desktop Listbox.

Use the CellStyle and ColumnStyle methods to add style information to selected cells and/or columns. This is the way to change the borders, font size and style, background, opacity, and other styling attributes of WebListboxes. See the WebStyle entry for more information on the features that can be added via Web Styles.


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

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

If you want to select individual cells in the ListBox, you can do so using WebStyles. First, create a WebStyle (call it SelectedCellStyle) and set its Background to blue and its Text Color to white (or other colors of your own choosing).

In the SelectionChanged event handler for the ListBox, disable the selected row to prevent the selection from hiding the cell style:

If Me.ListIndex >= 0 Then
// Turn off row selection to allow cell style to appear
Me.Selected(Me.ListIndex) = False
End If

In the CellClick event handler, apply the SelectedCellStyle to the cell that was clicked:

// Clear all cell styles so only the selected cell is styled
For r As Integer = 0 To Me.RowCount - 1
For c As Integer = 0 To Me.ColumnCount - 1
Me.CellStyle(r, c) = Nil

// Set style for selected cell
Me.CellStyle(row, column) = SelectedCellStyle

See Also

DataSource, WebStyle, WebPicture classes