|
When you create a List it is very similar to creating an Array, the Difference is a List allows you to see the elements in your array. As you add items to the list each item is given an INDEX VALUE which tells us where the computer is looking in the List.
The First Item loaded to an Array or a List has an INDEX VALUE of 0, the second one has an INDEX of 1 and so on.
When You Click on an Item in the List you can retrieve the VALUE of the INDEX
myVariable = List1.ListIndex
You can then use myVariable to Remove that exact item from the list.
You can then count through the remaining items and recalculate your total.
When an Item is removed from the list, all values above that point are reduced, leaving you with a list of consecutive INDEXes, ie if you had 5 items and remove #2, the List would now have indexes of 0,1,2,3
You can retrieve the number of items in a list with
myListItems = List1.ListCount
This will always be 1 number higher than the last elements' INDEX Value.
In a List of 6 Items myListItems will = 6 but the highest INDEX is 5, the LOWEST INDEX is 0
|