---
title: "getNumListBoxItems"
canonical: "https://help.vicon.com/space/ShogunPost120/1043039605/getNumListBoxItems"
format: markdown
---
# Description

Gets the number of items in the list box user control that is specified by `userControlID`.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `getNumListBoxItems userControlID` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `userControlId` | int | yes | ID of user control to operate on. |

### Flags

None

## Return value

integer 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Get the number of List Box User Control items 
int $windowId;
int $controlId;
int $numItems;
 
// 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";
 
// Get the number of items
$numItems = `getNumListBoxItems $controlId`;
print $numItems;
```

# Additional information

## Related commands

- [addListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043038522)
- [createListBox](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043039574)
- [deleteAllListBoxItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043038472)
- [deleteListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043038890)
- [findListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043038899)
- [getListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043038728)
- [getListBoxSelItems](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043039675)
- [selectListBoxItem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043039785)
- [setListBoxHandler](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost120/pages/1043039834)