Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does ASCAN() compare object?
Message
From
25/12/1999 11:10:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/12/1999 10:24:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00308548
Message ID:
00308554
Views:
21
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform