Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing an Object that doesnt exist !!! (Yet !)
Message
 
 
To
24/08/2001 15:48:19
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00548939
Message ID:
00548949
Views:
9
Use the Type() function to check for the existence.

if type("THISFORM.ACTIVECONTROL.NAME") = 'C' then

Above makes sure ActiveControl is an object with a Name property. You can check to make sure it is Grid1.

HTH.

>This has got to be easy, that is why I can't figure it out!
>
>Sometimes, when the following code is run, the object GRID1 has not been created yet. Which is OK, but I get the error 'ActiveControl Grid1 does not exist', basically.
>
>
>IF UPPER(THISFORM.ACTIVECONTROL.NAME) = 'GRID1'
> THISFORM.ACTIVECONTROL.COLUMN3.TEXT1.KEYPRESS(134,0)
>ELSE
> THISFORM.ACTIVECONTROL.KEYPRESS(134,0)
>ENDIF
>
>
>This code is in a timer, and runs often, so once in awhile 'GRID1' is not created just yet and I get the error.
>
>What is the best way to prevent the error? Is there a way to check to see if the object exists before I go on with this code?
>
>Thanks for your help,
>for I am just a rookie.
>THX!
>Seth
Larry Miller
MCSD
LWMiller3@verizon.net

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

Click here to load this message in the networking platform