Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Smoothing the code
Message
De
26/08/2006 11:27:53
 
 
À
26/08/2006 11:22:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01148816
Message ID:
01148819
Vues:
14
Fortunately it's weekend, I guess I'm not the only one who really needs a little rest. This should work better.... :-)
local lnColumn, lcVariable
for lnColumn = 24 to 11 step -1
  lcVariable = "mx" + transform(lnColumn)
  if evaluate(lcVariable) > 0
    ThisForm.Grid1.DeleteColumn(lnColumn)
  endif
next
>Of course; just use a loop. Also: When deleting several columns, you should normally delete from right to left; otherwise, the wrong column may be deleted - if you delete column #3, column #4 becomes the new column #3, column #5 becomes column #4, etc. (I will not do this now, because I am not so sure about the logic of your program.)
>
>
>local lnColumn, lcVariable
>for lnColumn = 11 to 24
>  lcVariable = "mx" + transform(lnColumn)
>  if evaluate(lnCounter) > 0
>    ThisForm.Grid1.DeleteColumn(lnColumn)
>  endif
>next
>
>
>
>>hi all,
>>can any one create short and smooth these codes,
>>
>>IF (mx11)>0
>>thisform.grid1.DeleteColumn(11)
>>endif
>>*
>>IF  (mx12)>0
>>thisform.grid1.DeleteColumn(12)
>>endif
>>*
>>*
>>IF  (mx13)>0
>>thisform.grid1.DeleteColumn(13)
>>endif
>>*
>>IF  (mx14)>0
>>thisform.grid1.DeleteColumn(14)
>>endif
>>*
>>IF  (mx15)>0
>>thisform.grid1.DeleteColumn(15)
>>endif
>>
>>IF  (mx16)>0
>>thisform.grid1.DeleteColumn(16)
>>endif
>>IF  (mx17)>0
>>thisform.grid1.DeleteColumn(17)
>>endif
>>IF  (mx18)>0
>>thisform.grid1.DeleteColumn(18)
>>endif
>>*
>>IF  (mx19)>0
>>thisform.grid1.DeleteColumn(19)
>>endif
>>
>>IF  (mx20)>0
>>thisform.grid1.DeleteColumn(20)
>>endif
>>IF  (mx21)>0
>>thisform.grid1.DeleteColumn(21)
>>endif
>>
>>IF  (mx22)>0
>>thisform.grid1.DeleteColumn(22)
>>endif
>>IF  (mx23)>0
>>thisform.grid1.DeleteColumn(23)
>>endif
>>IF  (mx24)>0
>>thisform.grid1.DeleteColumn(24)
>>endif
>>ENDWITH
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform