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:
00453875
Views:
20
That may be true but it works all the time every time. With the example below, in order to not throw an error, you would first have to check for the existence of Pgf1, make sure it was an object, use pemstatus on it to check for Pag1, make sure that was an object and then use pemstatus again to check for txtThis. Type() does all this in one step. Probably why it's 6 times slower. ;-)

>Hi, Jim!
>
> Are you really use type function for this? As far as I know, type function works 6 times slower than PEMSTATUS...
>
>>Tony,
>>
>>You can check TYPE("Thisform.pgf1.pag1.txtThis.Name") = "C" If the data type of the Name property is C then it exists, if not it does not exist.
>>
>>
>>>Hi,
>>>
>>>Suppose I have a a control name like "pgf1.pag1.txtThis" and I want to know if it still exists on a particular open form. Is there an easy way to do this?
>>>
>>>If it helps, the reason I have the control name is that I'm allowing the user to customize controls. When a form opens I look through a table to see if any of there any customized controls for this form. If so, I use the saved name to create a control object and then customize away. However, I'd like to make sure the control actually exists without having to parse out the name and doing a PEMSTATUS on each level. Being a VFP newbie, I can't figure out a better way.
>>>
>>>Thanks.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform