Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox with multiselect deleting unselected items
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00855548
Message ID:
00855837
Vues:
16
>I have a listbox set up with the rowsource as an SQL statement creating the cursor TmpHistory. When the user double-clicks on an item, or selects multiple items and clicks on a command button, the following code fires in the MoveToActive() method of the form:
>
>***************************************************************
>LOCAL lnNumberSelected
>
>Thisform.lblNoSelected.Caption = "Returning Records To Active......Please Wait"
>
>lnNumberSelected = 0
>For nCnt = 1 to Thisform.lstHistory.ListCount
> If Thisform.lstHistory.Selected(nCnt)
> lnNumberSelected = lnNumberSelected + 1
> Thisform.lstActive.Additem(Thisform.lstHistory.List(nCnt))
> Select tmpHistory
> Go nCnt
> Thisform.DeleteHistory()
> Endif
>EndFor
>
>Thisform.lstHistory.Requery()
>Thisform.lstActive.Requery()
>
>***************************************************************
>
>DeleteHistory() Method
>
>....
> deletes records matching 'cjob' and 'cver' fields in tmpHistory
>....
>
>****************************************************************
>
>It works great most of the time but every once in a while it removes some records that it shouldn't. I don't do any removeitem statements....just a requery when all in list has been processed.
>
>Any ideas???
>Thanks.

A personal experience thing in VFP 5. I haven't done this in awhile, so I don't know if the behaviour has changed.
When checking if an item is selected, the selected status would switch on some items, most of the time I noticed it would be unselected. If I made sure the focus was on the listbox with a SetFocus() and the problem went away.

Not sure if this will give you better results,
Tracy
Tracy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform