Results 1 to 4 of 4

Thread: listbox entries and retrieving them

  1. #1
    Guest
    I've been through the more documentation than I can shake a stick at and can't find the answer to this question:

    I have a listbox with n entries. I need to be able to "walk" down the listbox entries and compare them against a specific value.

    How do I sequentially retrieve the values from 0-(listcount-1)?

    Thanks
    DerFarm

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    You can get at the data using the list property. For instance
    Code:
    for i = 0 to list1.listcount - 1
    msgbox list1.list(i)
    next

  3. #3
    Guest
    Make sure your list is no longer than 100.

    And try this:

    Code:
    Private Sub Command1_Click()
    On Error Resume Next
    List1.ListIndex = -1
    Do Until List1.ListIndex = List1.ListCount
    List1.ListIndex = List1.ListIndex + 1
    If List1 = specificvalue Then MsgBox "FOUND!": Exit Sub
    Loop
    End Sub

  4. #4
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    I have used listboxes with well over a thousand entries with no difficulties whatsever. I know that the design time member max differs from the run time max (32,000 I think), but I cannot find the info in the MSDN anywhere.

    try this, it works:
    Code:
    Dim i As Long
    For i = 0 To 32000
        List1.AddItem i
    Next
    
    For i = 0 To List1.ListCount - 1
        If List1.List(i) = "20000" Then _
            MsgBox "FOUND"
    Next
    [Edited by CthulhuDragon on 09-11-2000 at 04:21 PM]

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