Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List boxes
Message
De
29/07/2003 13:39:40
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/07/2003 13:17:03
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00814604
Message ID:
00814620
Vues:
8
>All,
>
> I am creating a mover control. When the user clicks an add or remove button my code SHOULD take the selected item or items, moves them to the proper location and removes them from the proper location. However, it sometimes works and sometimes transfers blanks between the two listboxes. My code is below, what's wrong?
>
>LOCAL I
>I = 1
>DO While I < = this.Parent.lstLeft.ListCount
> IF this.Parent.lstleft.Selected(I)
> this.Parent.lstright.AddItem(this.Parent.lstleft.ListIndex)
> this.Parent.lstleft.RemoveItem(this.Parent.lstleft.ListIndex)
> ENDIF
> I = I + 1
>ENDDO

Jim,
Loop from .Listcount to 1 (and use for..endfor instead) :
for I=this.Parent.lstLeft.ListCount to 1 step -1
	IF this.Parent.lstleft.Selected(I)
		this.Parent.lstright.AddItem(this.Parent.lstleft.ListIndex)
		this.Parent.lstleft.RemoveItem(this.Parent.lstleft.ListIndex)
	ENDIF
ENDfor
Also check VFP moverlist and FoxyClasses MoverList classes.
PS: ListIndex there ? I think you poulate right items somewhere.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform