: Set a ordinary listbox with Sorted=True and Multiselect=2
: Private Sub Form_Load()
: List1.AddItem "ann"
: List1.AddItem "beth"
: List1.Selected(0) = True
: End Sub
: Start the program, then type in "b". The second item will be higlighted and selected, as it should, leaving the first one unselected. But - one or two seconds later, the first item is selected again!!!
: Further testing shows that the "ann" item now has the Selected property set to False - even if it (incorrectly) shows up as "selected" - along with the "beth" item (which now has been selected by typing "b")...
: Any way around this?
this might be all happening 'coz of "Sorted=True". See MSDN help for this property which says,
When this property is True, Visual Basic handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required by the addition or removal of items.
Note: Using the AddItem method to add an element to a specific location in the list may violate the sort order, and subsequent additions may not be correctly sorted.