I keep talking about. I haven t mentioned yet, the Selected Property. List1.Selected or we ll receive a compile error. In other words, the Selected Property only exists for items in the behind the scenes array. If this is beginning to make sense to you, then the rest of the code starts to fall into place.
Next loop is selected.
Then If it is, we add that item to the right-hand ListBox using the AddItem method of the ListBox. Like the Selected Property, the List Property exists only for items in this behind the scenes array we ve been talking about. It contains the text value of the item that is selected. Finally, if the item is selected, we remove it from the first ListBox using the RemoveItem method. Since the RemoveItem method requires the index value of the item in the ListBox, the value of the variable i can be used as the argument.