General information
Category:
Coding, syntax & commands
>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.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only