I use the PEMSTATUS() command to verify existance of an object/property:
IF PEMSTATUS(thisform,"cmdSuchAndSuch",5)
ELSE
ENDIF
If you try to use VARTYPE() it will fail if the object does not exist. TYPE() will work -- it will return "U" if it does not exist.
>I always make checks like
>
>if type('thisform.cmdSuchAndSuch.Name') = 'C'
>
>and never had problems with this approach.
>
>>I have this simplified code:
>>
>>WITH goToolBar
>> .LockScreen = .T.
>> IF TYPE('.cmdBoxing') = 'O'
>> .RemoveObject('cmdBoxing')
>> .LockScreen = .F.
>> ENDIF
>>ENDWITH
>>
>>That code is executed twice. First time it works fine, second it tries to remove the button again because TYPE('.cmdBoxing') = 'O' is still true. Reffering goToolBar.cmdBoxing.Name gives an error.
>>What am I missing?