The application uses the list count property of listbox to store the number of item in the list. ListCount is always one more than the highest list index, since list index begins with zero.
Ex. totalItem = lstItem.listCount
When a project is running and the user selects an item from the list, the index number of that item is stored in the listIndex property of the listbox. The listindex of the first item in the list is zero. If no list item is selected , the list index property set to -1. We can use listIndex property to select an item in list or deselect all items in code.
Ex. lstCopyType.listIndex = 3
lstCopyType.listIndex = -1
„Deselect all items in list.