Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I know at runtime if a class is defined
Message
 
À
09/03/2004 00:12:22
James Chan
Objectmastery Pty Ltd
Hawthorn, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00884319
Message ID:
00884400
Vues:
10
Try this...
TRY 
	o=crea("somethingthatdoesnotexist")
CATCH TO oErr
	? "Catch:",oErr.ErrorNo
ENDTRY
>Is there any function like
IsDefined("MyClass")
that tells me if MyClass is defined? I need this function in a loop where the class name is constructed at runtime and, if defined, an object will be instantiated. e.g.
>
>for Loop = 1 to MaxClass
>  NewClass = ConstructClassName(Loop)
>  if IsDefined(NewClass)
>    oObject = CreateObject(NewClass)
>    * do something
>  end
>endfor
>
>
>Thanks
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform