Selected Listbox Item using ItemData value??? 
Author Message
 Selected Listbox Item using ItemData value???

Assuming this is even possible, how would you go about programatically
selected an item in a listbox *based on that item's ItemData value
only*???

Thanks in advance.



Wed, 18 Apr 2001 03:00:00 GMT  
 Selected Listbox Item using ItemData value???
Alan:
You can access the Listbox ItemData Property in the same way you would
access the List Property.  The following example loops through the List
searching for a value of 10 in the ItemData Property for each position in
the list.  If found, the ListIndex is set to that position in the list.

Dim Number As Long
Dim Index As Long
Number = 10
List1.ListIndex = -1
For Index = 0 To List1.ListCount - 1
   If Number = List1.ItemData(Index) Then
      List1.ListIndex = Index
      Exit For
   End If
Next

John

Quote:

>Assuming this is even possible, how would you go about programatically
>selected an item in a listbox *based on that item's ItemData value
>only*???

>Thanks in advance.



Thu, 19 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How To: Select a item in a listbox by the itemdata

2. Removing item from ListBox control using ItemData

3. Q: Select combo item using ItemData

4. combobox:Select item by itemdata

5. populating vb.net listbox from selected items of another listbox

6. Using Itemdata on a listbox

7. Can you select an item in a listbox thru VBA

8. Selecting Item In Listbox

9. Selecting All Items In a MultiSelect ListBox

10. Remove selected item from listbox

11. Programmatically selecting items on ListBox problem

12. Setting ListBox item to selected..

 

 
Powered by phpBB® Forum Software