# ListBox

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Control](/api/wisej.web/general/control.md)
  * [ListControl](/api/wisej.web/lists-and-grids/listcontrol.md)
    * [ListBox](/api/wisej.web/lists-and-grids/listbox.md)

Represents a control to display a list of items.

{% tabs %}
{% tab title="C#" %}

```csharp
public class ListBox : ListControl, ILabel, IReadOnly
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class ListBox
    Inherits ListControl
    Implements ILabel, IReadOnly
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) ListBox()

Initializes a new instance of [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) ListBox(onSelectedIndexChanged)

Initializes a new instance of the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) class with the specified settings.

| Name                       | Type                                                                                | Description                                                     |
| -------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Optional [SelectedIndexChanged](#selectedindexchanged) handler. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListBox(dataSource, displayMember, valueMember, iconMember, onSelectedIndexChanged)

Initializes a new instance of [ListBox](/api/wisej.web/lists-and-grids/listbox.md) class with the specified settings.

| Name                       | Type                                                                                | Description                                                                           |
| -------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| **dataSource**             | [Object](https://docs.microsoft.com/dotnet/api/system.object)                       | Initial [DataSource](/api/wisej.web/lists-and-grids/listcontrol.md#datasource).       |
| **displayMember**          | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [DisplayMember](/api/wisej.web/lists-and-grids/listcontrol.md#displaymember). |
| **valueMember**            | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [ValueMember](/api/wisej.web/lists-and-grids/listcontrol.md#valuemember).     |
| **iconMember**             | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [IconMember](/api/wisej.web/lists-and-grids/listcontrol.md#iconmember).       |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Optional [SelectedIndexChanged](#selectedindexchanged) handler.                       |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListBox(location, size, onSelectedIndexChanged)

Initializes a new instance of the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) class with the specified settings.

| Name                       | Type                                                                                | Description                                                     |
| -------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **location**               | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                 | Initial location.                                               |
| **size**                   | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                   | Initial size.                                                   |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Optional [SelectedIndexChanged](#selectedindexchanged) handler. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListBox(location, size, dataSource, displayMember, valueMember, iconMember, onSelectedIndexChanged)

Initializes a new instance of the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) class with the specified settings.

| Name                       | Type                                                                                | Description                                                                           |
| -------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| **location**               | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                 | Initial location.                                                                     |
| **size**                   | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                   | Initial size.                                                                         |
| **dataSource**             | [Object](https://docs.microsoft.com/dotnet/api/system.object)                       | Initial [DataSource](/api/wisej.web/lists-and-grids/listcontrol.md#datasource).       |
| **displayMember**          | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [DisplayMember](/api/wisej.web/lists-and-grids/listcontrol.md#displaymember). |
| **valueMember**            | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [ValueMember](/api/wisej.web/lists-and-grids/listcontrol.md#valuemember).     |
| **iconMember**             | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [IconMember](/api/wisej.web/lists-and-grids/listcontrol.md#iconmember).       |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Optional [SelectedIndexChanged](#selectedindexchanged) handler.                       |

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) AllowHtml

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating that the control can display HTML in the Text property. (Default: `False`)

### ![](/files/lzopMboA31bVq8UIcbT3) AllowSelection

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) currently enables selection of list items.

### ![](/files/lzopMboA31bVq8UIcbT3) DefaultSize

[Size](https://docs.microsoft.com/dotnet/api/system.drawing.size): Returns the default size for a text box control.

### ![](/files/hsR4ok3152WyAf8J2C1u) HorizontalScrollbar

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether a horizontal scroll bar is displayed in the control. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) IncrementalSelection

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether items are selected incrementally as the user types within a timeout of 1 second. (Default: `True`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ItemHeight

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the height of the list items. When the value is -1, uses the value set in the theme. (Default: `-1`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The assigned value is less than -1; or the assigned value is greater than 500.

### ![](/files/hsR4ok3152WyAf8J2C1u) Items

[ObjectCollection](/api/wisej.web/lists-and-grids/listbox/wisej.web.listbox.objectcollection.md): Returns the collection of the items contained in this [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Label

[LabelWrapper](/api/wisej.web/editors/wisej.web.labelwrapper.md): Provides a label related to the control.

### ![](/files/hsR4ok3152WyAf8J2C1u) LabelText

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the localizable label associated with this control. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) LazyLoading

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the items in the list are send to the client when the list becomes visible the first time. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Orientation

[Orientation](/api/wisej.web/enumerations/wisej.web.orientation.md): Returns or sets whether the list box displays the items vertically (default) or horizontally. <mark style="color:blue;background-color:green;">Since 3.1</mark> (Default: `Vertical`)

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) Horizontal orientation is not supported with virtual scrolling.

### ![](/files/hsR4ok3152WyAf8J2C1u) ReadOnly

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the control is read-only. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) RightClickSelection

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the item under the pointer gets selected on a right click. (Default: `False`)

When the right click lands outside of a selected area the selection is not changed regardless of the value of [RightClickSelection](#rightclickselection).

### ![](/files/hsR4ok3152WyAf8J2C1u) ScrollAlwaysVisible

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the vertical scroll bar is shown at all times. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedIndex

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the zero-based index of the currently selected item in a [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The assigned value is less than -1 or greater than or equal to the item count.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The [SelectionMode](#selectionmode) property is set to None.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedIndices

[SelectedIndexCollection](/api/wisej.web/lists-and-grids/listbox/wisej.web.listbox.selectedindexcollection.md): Returns a collection that contains the zero-based indexes of all currently selected items in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedItem

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns or sets the currently selected item in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedItems

[SelectedObjectCollection](/api/wisej.web/lists-and-grids/listbox/wisej.web.listbox.selectedobjectcollection.md): Returns a collection containing the currently selected items in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectionMode

[SelectionMode](/api/wisej.web/enumerations/wisej.web.selectionmode.md): Returns or sets the method in which items are selected in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md). (Default: `One`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Sorted

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the items in the combo box are sorted. (Default: `False`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) An attempt was made to sort a [ListBox](/api/wisej.web/lists-and-grids/listbox.md) that is attached to a data source.

### ![](/files/hsR4ok3152WyAf8J2C1u) Tools

[ComponentToolCollection](/api/wisej.web/editors/wisej.web.componenttoolcollection.md): Returns the instance of [ComponentToolCollection](/api/wisej.web/editors/wisej.web.componenttoolcollection.md) associated with this control.

### ![](/files/hsR4ok3152WyAf8J2C1u) TopIndex

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the index of the first visible item in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) BeginUpdate()

Not used. Kept for compatibility.

### ![](/files/hsR4ok3152WyAf8J2C1u) ClearSelected()

Unselects all items in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/lzopMboA31bVq8UIcbT3) CreateItemCollection()

Creates a new instance of the item collection.

**Returns:** [ObjectCollection](/api/wisej.web/lists-and-grids/listbox/wisej.web.listbox.objectcollection.md). A [ObjectCollection](/api/wisej.web/lists-and-grids/listbox/wisej.web.listbox.objectcollection.md) that represents the new item collection.

### ![](/files/lzopMboA31bVq8UIcbT3) Dispose(disposing)

Disposes the control.

| Parameter     | Type                                                            | Description                                                                 |
| ------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true when this method is called by the application rather than a finalizer. |

### ![](/files/hsR4ok3152WyAf8J2C1u) EndUpdate()

Not used. Kept for compatibility.

### ![](/files/hsR4ok3152WyAf8J2C1u) FindString(text)

Returns the index of the first item in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) that starts with the specified string.

| Parameter | Type                                                          | Description                                                                      |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [String](https://docs.microsoft.com/dotnet/api/system.string) to search for. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first item found; returns -1 if no match is found.

### ![](/files/hsR4ok3152WyAf8J2C1u) FindString(text, startIndex)

Returns the index of the first item in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) beyond the specified index that contains the specified string. The search is not case sensitive.

| Parameter      | Type                                                          | Description                                                                                                                   |
| -------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [String](https://docs.microsoft.com/dotnet/api/system.string) to search for.                                              |
| **startIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first item found; returns -1 if no match is found, or 0 if the *text* parameter specifies [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty).

### ![](/files/hsR4ok3152WyAf8J2C1u) FindStringExact(text)

Finds the first item in the combo box that matches the specified string.

| Parameter | Type                                                          | Description                                                                      |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [String](https://docs.microsoft.com/dotnet/api/system.string) to search for. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first item found; returns -1 if no match is found, or 0 if the *text* parameter specifies [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty).

### ![](/files/hsR4ok3152WyAf8J2C1u) FindStringExact(text, startIndex)

Finds the first item after the specified index that matches the specified string.

| Parameter      | Type                                                          | Description                                                                                                                   |
| -------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [String](https://docs.microsoft.com/dotnet/api/system.string) to search for.                                              |
| **startIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first item found; returns -1 if no match is found, or 0 if the *text* parameter specifies [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty).

### ![](/files/hsR4ok3152WyAf8J2C1u) GetSelected(index)

Returns a value indicating whether the specified item is selected.

| Parameter | Type                                                        | Description                                                              |
| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------ |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The zero-based index of the item that determines whether it is selected. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the specified item is currently selected in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md); otherwise, false.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The specified index was outside the range of valid values.

### ![](/files/lzopMboA31bVq8UIcbT3) OnDataSourceChanged(e)

Fires the [DataSourceChanged](/api/wisej.web/lists-and-grids/listcontrol.md#datasourcechanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnDisplayMemberChanged(e)

Fires the [DisplayMemberChanged](/api/wisej.web/lists-and-grids/listcontrol.md#displaymemberchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnLoad(e)

Fires the [Load](#load) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnReadOnlyChanged(e)

Fires the [ReadOnlyChanged](#readonlychanged) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnSelectedIndexChanged(e)

Fires the [SelectedIndexChanged](#selectedindexchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnSortedChanged(e)

Fires the [SortedChanged](#sortedchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnToolClick(e)

Fires the ToolClick event.

| Parameter | Type                                                                         | Description                                                                                                  |
| --------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **e**     | [ToolClickEventArgs](/api/wisej.web/editors/wisej.web.toolclickeventargs.md) | A [ToolClickEventArgs](/api/wisej.web/editors/wisej.web.toolclickeventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnValueMemberChanged(e)

Fires the [ValueMemberChanged](/api/wisej.web/lists-and-grids/listcontrol.md#valuememberchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                        | Description      |
| --------- | ----------------------------------------------------------- | ---------------- |
| **e**     | [WisejEventArgs](/api/wisej.core/general/wisejeventargs.md) | Event arguments. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebUpdate(state)

Updates the client component using the state information.

| Parameter | Type                                                          | Description           |
| --------- | ------------------------------------------------------------- | --------------------- |
| **state** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic state object. |

### ![](/files/lzopMboA31bVq8UIcbT3) RefreshItem(index)

Refreshes the item contained at the specified location.

| Parameter | Type                                                        | Description                          |
| --------- | ----------------------------------------------------------- | ------------------------------------ |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The location of the item to refresh. |

### ![](/files/lzopMboA31bVq8UIcbT3) RefreshItems()

Reloads all the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) items from the data source.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectAll()

Selects all the items in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

### ![](/files/lzopMboA31bVq8UIcbT3) SetItemCore(index, value)

Sets the object with the specified index in the derived class.

| Parameter | Type                                                          | Description                    |
| --------- | ------------------------------------------------------------- | ------------------------------ |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The array index of the object. |
| **value** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The object.                    |

### ![](/files/lzopMboA31bVq8UIcbT3) SetItemsCore(value)

Sets the specified array of objects in a collection in the derived class.

| Parameter | Type                                                                    | Description        |
| --------- | ----------------------------------------------------------------------- | ------------------ |
| **value** | [IList](https://docs.microsoft.com/dotnet/api/system.collections.ilist) | An array of items. |

### ![](/files/hsR4ok3152WyAf8J2C1u) SetSelected(index, selected)

Selects or clears the selection for the specified item in a [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

| Parameter    | Type                                                            | Description                                                                                                                      |
| ------------ | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **index**    | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)     | The zero-based index of the item in a [ListBox](/api/wisej.web/lists-and-grids/listbox.md) to select or clear the selection for. |
| **selected** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to select the specified item; otherwise, false.                                                                             |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The specified index was outside the range of valid values.
* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) The [SelectionMode](#selectionmode) property is set to None.

### ![](/files/lzopMboA31bVq8UIcbT3) Sort()

Sorts the items in the [ListBox](/api/wisej.web/lists-and-grids/listbox.md).

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) Load

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [LazyLoading](#lazyloading) property is true and the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) is first shown.

When [LazyLoading](#lazyloading) is true An application may fill the items at any time prior to the [ListBox](/api/wisej.web/lists-and-grids/listbox.md) being shown, or while processing the [Load](#load) event.

### ![](/files/hsR4ok3152WyAf8J2C1u) ReadOnlyChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the value of the [ReadOnly](#readonly) property has changed.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedIndexChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [SelectedIndex](#selectedindex) property or the [SelectedIndices](#selectedindices) collection has changed.

### ![](/files/hsR4ok3152WyAf8J2C1u) SortedChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [Sorted](#sorted) property has changed.

### ![](/files/hsR4ok3152WyAf8J2C1u) ToolClick

[ToolClickEventHandler](/api/wisej.web/editors/wisej.web.toolclickeventhandler.md) Fired when a [ComponentTool](/api/wisej.web/editors/wisej.web.componenttool.md) is clicked.

## Inherited By

| Name                                                               | Description                                                                                                                 |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md) | Displays a [ListBox](/api/wisej.web/lists-and-grids/listbox.md) in which a check box is displayed to the left of each item. |

## Implements

| Name                                                                              | Description                                                                                                                                                                                                                                     |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.                                                                                                                                 |
| [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                                                                                                                                                   |
| [IDropTarget](/api/wisej.web/interfaces/wisej.web.idroptarget.md)                 | Controls that support drag & drop operations implement this interface.                                                                                                                                                                          |
| [ILabel](/api/wisej.web/interfaces/wisej.web.ilabel.md)                           | Provides access to the [LabelWrapper](/api/wisej.web/editors/wisej.web.labelwrapper.md) associated with the controls that implement this interface.                                                                                             |
| [IReadOnly](/api/wisej.web/interfaces/wisej.web.ireadonly.md)                     | Provides access to the [ReadOnly](/api/wisej.web/interfaces/wisej.web.ireadonly.md#readonly) property for coontrols that support the read-only mode.                                                                                            |
| [IModified](/api/wisej.web/interfaces/wisej.web.imodified.md)                     | Provides access to the [Modified](/api/wisej.web/interfaces/wisej.web.imodified.md#modified) property and [ModifiedChanged](/api/wisej.web/interfaces/wisej.web.imodified.md#modifiedchanged) event for controls that implement this interface. |
| [IValidation](/api/wisej.web/interfaces/wisej.web.ivalidation.md)                 | Provides access to the validation events and properties property for controls that support validation.                                                                                                                                          |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                                                                                                                                                  |
| [IWisejControl](/api/wisej.core/interfaces/wisej.core.iwisejcontrol.md)           | All wisej controls derived from the [Control](/api/wisej.web/general/control.md) class must implement this interface.                                                                                                                           |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                                                                                                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/lists-and-grids/listbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
