Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you select items in a listbox by value?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00453572
Message ID:
00453596
Vues:
32
I've had luck setting ListBox pointer using value. I don't know if ADDItem is required. The Pointer Value needs to match the list value in case and lengtht.
With your form open and the lisbox populated try this:
MyForm.MyListBox.Value=some charracter string


>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
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform