Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check for existence of a control on a form
Message
From
08/11/1999 20:33:47
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00288347
Message ID:
00288802
Views:
18
>Gerard,
>Christof's suggestion was correct. However, if the control is .Null, his code will give you .T. back but your base class code will still bomb. You'll need to check to see if the value is .Null, OR, and simpler, check to see if the the control NAME is type "C"
>
>IF type('thisform.mycontrol') =="O" AND !isnull(thisform.mycontrol)
>...
>
>or
>
>IF type('thisform.mycontrol') =="O" AND type('thisform.mycontrol.name') == "C"
>...
>
>
>HTH
>Barbara
>
>>I have some code in my Base Class which operates on form controls. Sometimes, for certain forms, these controls wont exist. Is there a way of checking for the existence of a control on a form .i.e.
>>
>>if ThisForm.Mycontrol exists
>> do....
>>else
>> do ....
>>endif
>>
>>Thsi code would want to be able to check for any control, i.e. Txtbox, Shape, Gris etc.
>>
>>Regards,
>>
>>Gerard


I prefer Jim Booth's way. < g >

IF type('thisform.mycontrol.Name') =="C"
DO ...
ELSE
DO ...
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform