Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Destroying an object
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00046886
Message ID:
00046904
Vues:
21
>How do I destroy an object created via CreateObject()?
>
>In VB you use: Set oMyObject = Nothing (I know, I know, VB is the evil empire but I needed an example. Please forgive me almighty Fox Gods! )
>
>What do I use in VFP?
>

Hi Gary,

Please don't make us out to be small minded and over protective of VFP. The right tool for the right job, thats all. :-)

And as for destroying an object, VFP can do it the same way as VB.

oMyObject = .NULL.

Don't forget though if you do the following:

oObject1 = CREATEOBJECT("MyClass")
oObject2 = oObject1
oObject1 = .NULL.

The object will not be destroyed as there still exists a reference to it in oObject2. If you really want to destroy the object no matter how many refereneces there are to it, you must add the following method to your class. (Unless its a form, a form already has the method built in)

PROCEDURE Release()
RELEASE this
ENDPROC

When this method is added to your class you can then use,

oObject1.Release()

and your object will be destroyed.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform