Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting items from lists
Message
De
11/08/2005 10:09:11
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01040178
Message ID:
01040227
Vues:
10
>Can anybody tell why when I click my remove button on my form that I get the messagebox stating I havent select anything in the list to delete when I have prior to the item actually being removed succesfully.
>
>
>with thisform.pageframe1.page6.list2
>for ix=1 to .Listcount
> if .Selected[ix]
> 	IF MESSAGEBOX("Are you sure you want to delete this item?",4)=6
> 	 	SELECT cmscomp
> 	 	DELETE
> 	ENDIF
> 	thisform.pageframe1.page6.list2.Requery()
> ELSE
> 	MESSAGEBOX("You have not selected a composition type to remove",0)
> endif
>ENDFOR
>ENDWITH
>
The way you've structured this, you get the message for each unselected record. Try something like this instead:
with thisform.pageframe1.page6.list2
   lAny = .F.
   FOR ix = .ListCount TO 1
     IF .Selected[ix]
       IF MESSAGEBOX("Are you sure you want to delete this item?",4)=6
         DELETE IN cmsComp
         lAny = .T.
       ENDIF
     ENDIF
   ENDFOR

   IF NOT lAny
     MESSAGEBOX("You have not selected a composition type to remove",0)
   ENDIF
ENDWITH
Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform