Selected item to top of ListBox

HARRY

Active Member
Licensed User
Longtime User
Hi,

In a program I have a ListBox with many items. I want to help the user in scrolling as I know roughly which item he will need. I managed to select programmatically that item. It appears at the bottom of the ListBox. Does somebody know a possibility to get programmatically that selected item on the top of the list?

Harry
 

Cableguy

Expert
Licensed User
Longtime User
That's a thought one...
If you DO know what the probable choice is, then delete the item from the list box, and then add ity again to the first position....
listbox.additem(0)="myItem"
 

HARRY

Active Member
Licensed User
Longtime User
Hi,

Thanks for your suggestions. However, as the list is in alphabetic sequence, I cannot move items to another place. I found myself the following solution:

Find the index of the probable candidate
Add to it the number of visible items -1
Check on the Count and correct if necessary
Select the raised index
Select the original index

Using Visible is false and true around this operation gives an acceptable performance (as it does with various Table operations).

Harry
 
Top