Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you select items in a listbox by value?
Message
De
14/12/2000 15:13:58
 
 
À
14/12/2000 14:46:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00453572
Message ID:
00453588
Vues:
31
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform