Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does ASCAN() compare object?
Message
De
25/12/1999 11:10:40
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
25/12/1999 10:24:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00308548
Message ID:
00308554
Vues:
19
>Hi,
> I am using ASCAN to loop in my array. I get an error operator/operand mismatch.... what did I do wrong?
>
>DIMENSION myarray[2]
>LOCAL loForm
>myarray = THISFORM
>loForm = THISFORM
>ASCAN(MYARRAY, loForm)
>
>
>Thank you


John,
ascan() AFAIK doesn't compare objects. Instead do something like this :
* VFP6
lparameters toObject
for ix = 1 to alen(myArray)
  if type("myArray[ix]") = "O" and myArray[ix]=toObject
     return ix
  endif
endfor
return 0

* VFP5-3
lparameters toObject
for ix = 1 to alen(myArray)
  if type("myArray[ix]") = "O" and compobj(myArray[ix],toObject)
     lcOrgName = myArray[ix].name  && Save name
     myArray[ix].name = "__TEMP__" && Cahnge temporarily
     llSameObject = compobj(myArray[ix],toObject) && toObject.name changed too ?
     myArray[ix].name = lcOrgName  && Restore name
     if llSameObject
       return ix
     endif
  endif
endfor
return 0
Beware this routine threat the array as a simple one dimensional.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform