Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vartype function fixed in SP3...
Message
From
07/07/1999 05:48:34
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, California, United States
 
 
To
06/07/1999 20:55:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00237900
Message ID:
00238165
Views:
13
It works with COM, but it can't be counted on. Very often returns "O" for items that are not objects, i.e. arrays. Sometimes even primitives. Has something to do with the COM wrapper used, I think (variants).

>>To summarize:
>>
>>There are only 2 conditions in which I am able to get vartype to generate an error:
>>1. _vfp.foo  [or _vfp.anything not defined to _vfp]
>>
>>2. oForm = newobject("form")  && or pick any object to create
>>   vartype(oForm.BadProp) returns U
>>   oForm = .null.
>>   vartype(oForm) returns X
>>   vartype(oForm.anything) generates an error
>>
>>Personally, I see no problem with the generation of the error for the second condition. I am ambivalent about the first condition because I seldom use _vfp. If I do, I always make dang sure the property exists before I add it to my code.
>
>Well, VARTYPE doesn't throw an error when checking defined properties of COM objects, but it does throw an error for undefined properties of COM objects. (For any body that doesn't see the relevance, _VFP is actually VFP's COM interface, and not a native fox object).
>
>I suspect that you uncovered still one more situation that VARTYPE wasn't built to handle. I am actually a little surprised that VARTYPE works with COM properties at all.
Eric Shaneson
Cutting Edge Consulting
Previous
Reply
Map
View

Click here to load this message in the networking platform