Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove items from List Box
Message
De
09/06/2007 18:05:08
Randy Hooper
Ranco Business Software
Tampa, Floride, États-Unis
 
 
À
09/06/2007 17:30:57
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01231800
Message ID:
01231803
Vues:
13
Thanks, I'm going to go with your 2nd ideal.


>>How can I move item(s) from a list box campare to my table?
>>
>>this code is in a command button.
>>
>>
>>for i = 1 to thisform.list2.listCount
>>   go top
>>   locate for alltrim(categoryPick) == alltrim(thisform.list2.list(i))
>>   if !found()
>>     thisform.list2.removeItem(thisform.list2.listIndex)
>>   endif
>>endfor
>>
>
>This should work, but you need to go backwards, i.e.
>
>for i = thisform.list2.listCount to 1 step -1
>
>because when you remove the nth list element, the list is shorter by one - then the n+1st element is what at the loop start was actually n+2nd. Going backwards gives the effect that anything you've deleted is behind you, you won't step over it again.
>
>The simpler way would be to just base the listbox on a cursor derived from your table (even if just a single-field one), and repopulate the cursor in listbox's .requery(). That way you don't need any loops to match listbox with the table - you pull what you need from the table and tell the listbox to use it.
Foxpro is a sweet puppy

'cept it barks every now and then =)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform