Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test For Existence Of An Object
Message
From
13/12/2001 07:52:55
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
To
13/12/2001 07:41:25
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00593714
Message ID:
00593789
Views:
19
OR simply write VARTYPE(FormName.Grid) = 'O'
vartype is faster then type.
the drawn back is that vartype only evaluates the last statement so for example you have VARTYPE(obj1.obj2.property) and obj2 isn't an object you will get an error.

>>You should get type('objectname') = 'U' or other than 'O' if the object is not present.
>>Rajesh
>
>Unfortunately you can't just use type = "O" as a test.
>
>Try this:
>
>loObj = CREATEOBJECT("Form")
>loObj = .NULL.
>? TYPE("loObj")
>
>Gives "O", even though the object no longer exists.
>
>Either use:
>IF TYPE("loObj") = "O" AND NOT ISNULL( loObj)
>
>OR check the name property, which will only exist if the object does. Also this makes the code slightly shorter.
>
>IF TYPE("loObj.Name") = "C"
Alexandre Palma
Senior Application Architect
Previous
Reply
Map
View

Click here to load this message in the networking platform