Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if a property is on a object
Message
 
 
To
31/07/2008 14:22:39
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01335595
Message ID:
01335603
Views:
17
I may answered wrong question. If you want to check if property exists, use PEMSTATUS()
* Does property exist?
? PEMSTATUS(myobject, "myproperty",5)
The code I posted originally, checks if existing property holds an object reference
There's a typo in it. The property reference should not be enclosed in the quotes. Sorry about that.
* Is property an object?
IF VARTYPE(myobject.myproperty) = "O"

* For example
myobject = CREATEOBJECT("Empty")
ADDPROPERTY(myobject, "myproperty")
? VARTYPE(myobject.myproperty)
myobject.myproperty = NULL
? VARTYPE(myobject.myproperty)
myobject.myproperty = CREATEOBJECT("Empty")
? VARTYPE(myobject.myproperty)
>Thanks, that works great. Don't know why my brain is having a hard time with vartype these days. :)
>>
>>IF VARTYPE("myobject.myproperty") = "O"
>>
>>
>>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform