Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test For Existence Of An Object
Message
De
13/12/2001 07:41:25
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
 
À
13/12/2001 00:26:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00593714
Message ID:
00593785
Vues:
24
>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"
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform