Results 1 to 2 of 2

Thread: select item in dropdown list via itemdata?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    I was wondering if there was a way to select an item in a dropdown list via it's .ItemData value as opposed to the .List value..

    I know that you can use the following code to select the item via the .List value:

    Code:
    Combo1 = Combo1.List(1)
    How would I select the item via the .ItemData value?

    Any help would be appreciated..

    Dan

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Unfotunately there's no direct way of doing it, but you can loop through a listbox and if the ItemData is the one you need then selec it:
    Code:
    Dim i As Integer
    
    For i = 0 To List1.ListCount - 1
        'Or any value you're looking for
        If List1.ItemData(i) = 5 Then  
            List1.ListIndex = i
            Exit For
        End If
    Nex

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width