Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find if a value is already in the list
Message
From
18/06/2007 13:40:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01234037
Message ID:
01234043
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I'm working with my late colleague's form and it uses AddItem method to add items to the listbox. My question is: what would be the simplest way to check, if the item is already in the list?
>
>Here is the line of code:
>this.List1.AddItem(laResults[1, 1] + ' ' + laResults[1, 2])

>I actually want to be able to check for the code (first portion) in the list.
>
>Should I loop through all list content or there is a better way?
>
>Thanks in advance.

There is a way w/o looping. Set the value and check listindex. However since listboxes can't add much items with this approach you might not need to gain such a performance. Its slowness would be masked with few elements anyway.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform