Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining whether a control exists.
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00453834
Message ID:
00453984
Views:
34
;-)
I'm not talking about error caused by type() funtion ;)

I'm talking about the way type() function works internally (interpreted by VFP). Really, this function is just a wrapper around evaluate function. type() just disables error handling, calls evaluate, and returns result using vartype() or returns 'U' if error caused by evaluate. all this works internally and you don't see that. And, of course, that is why message() function changes its value after type() function call when type() returns 'U'.

BTW, if you know that type() can never return 'U', use 'vartype(evaluate())', this works more quickly compare to type().

>>;-)
>>Of course, you're right and not right. type() is slower because it uses error handling method (message() function after type() returns quite funny error messages sometimes ;). PEMSTATUS just reads the structures of object definition in memory. Completely different ways.
>Vlad,
>
>I have never gotten an error using TYPE() for checking the existance on an object. What error have you gotten?
>
>TYPE() takes longer because it evaluate the data type of an expression therefore it must first evaluate the expression which requires parsing the expression. PEMStatus() just reads the PEMs of an object. The problem is that PEMStatus() will error if one of the objects in the reference does not exist while type() will simply return U for undefined.
>
>VarType() is a totally different situation from Type().
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform