---
title: "deleteListBoxItem"
canonical: "https://help.vicon.com/space/ShogunPost116/341117643/deleteListBoxItem"
format: markdown
---
# Description

Deletes an item in the list box user control that is specified by `userControlID`.

To delete an item, either provide the index of the item to delete, or a string of the item to delete (but not both). The string must exactly match for it to be deleted.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `deleteListBoxItem userControlID itemIndex or "itemString"` |

### Arguments

> Macro (scroll-tablelayout)

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `itemString` | int | yes | Matching string of the item to delete. Either an index should be provided, or a string, but not both. |
| `index` | int | yes | Zero based index of the item to delete. Either an index should be provided, or a string, but not both. |
| `userControlId` | int | yes | ID of user control to operate on. |

### Flags

None

## Return value

integer

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Delete an item in a List Box User Control.
int $windowId;
int $controlId;
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
// Create the User Control on the Window. 
$controlId = `createListBox $windowId`;
 
// Add some items to the List Box.
addListBoxItem $controlId "Item 1";
addListBoxItem $controlId "Item 2";
addListBoxItem $controlId "Item 3";
addListBoxItem $controlId "Item 4";
 
// Delete the second and third items.
deleteListBoxItem $controlId 1;
deleteListBoxItem $controlId "Item 3";
```

# Additional information

## Related commands

- [addListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341116985)
- [createListBox](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341117432)
- [deleteAllListBoxItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341117601)
- [findListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341117826)
- [getListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341118342)
- [getListBoxSelItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341118348)
- [getNumListBoxItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341118449)
- [selectListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341119638)
- [setListBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost116/pages/341119970)