|
-
Sep 11th, 2000, 02:01 PM
#1
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
-
Sep 11th, 2000, 02:28 PM
#2
Lively Member
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
-
Sep 11th, 2000, 02:40 PM
#3
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
-
Sep 11th, 2000, 03:18 PM
#4
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|