Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you select items in a listbox by value?
Message
From
14/12/2000 15:13:58
 
 
To
14/12/2000 14:46:15
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00453572
Message ID:
00453588
Views:
30
Ok, thanks Trey,

I wanted to try and avoid having to loop through all the values, expecially since the RowSource table could contain upwards of 5,000 records... but, oh well... I'll see how your suggestion works.

- Brian

>
>Not directly
>Depending on the RowSourceType, there a number of options - this ought to work for any RowSourceType
lcSearch = "findthis"
>With thisform.list1
>     For ji = 1 To .ListCount
>          If .List(ji)=lcSearch
>               .ListIndex = ji
>               Exit
>          EndIf
>     EndFor
>EndWith
If the RowSourceType is an array or a alias or fields, you can go directly to the RowSource and find the value which will reflect in the listbox. e.g., if RowSourceType is an array, e.g., thisform.aSource
With thisform
>     .list1.ListIndex = Ceiling(AScan(.aSource, lcSearch)/ALen(.aSource,2))
>EndWith


VFP6 SP5, VFP8 SP1, VFP 9 SP 1 and Win XP SP 3 (unless otherwise specified)


www.wulfsden.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform