Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I know If a Object exist?
Message
 
À
20/11/1998 16:36:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00159912
Message ID:
00160015
Vues:
29
>if vartype(thisform.command1) == "O"
>** object exists
>endif

I thought so too, until yesterday I ran some code that looked like this:

IF VARTYPE(Thisform) = T_OBJECT AND Thisform.lSomething

VFP gave me a Thisform is not an object error. Supposedly VFP doesn't evaluate the second expression on an AND if the first is false, and if that's the case VARTYPE isn't always reliable, at least with respect to thisform.

Rather than the ISNULL check mentioned above, for all VFP classes, you can use

IF TYPE("Object.Name") = "C" or if you prefer the VFP constants IF TYPE("object.name") = T_CHARACTER.
Mike Feltman

F1 Technologies
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform