General information
Category:
Forms & Form designer
>A Form with a Private DS is instantiated with some Tables opened in Load. Another object is instantiated (noncontained by form) from within :-
>
>PUBLIC oRef
>oRef = CREATEOBJECT()
>
>oRef is here to stay after the form is released. After the Form’s release, we find that the DS is still valid. SET DATASESSION TO (nOldDS), and the tables are still opened with the record pointers intact.
>
>We can then say that objects created by CREATEOBJECT() from within the form that were not released prior to the Form's release, prevents the Form's PrivateDS from closing automatically
>
>I encountered this behavior a couple of months back, and wonder if there’s somethign I overlooked. Would also like to know if this behavior can be observed in VFP6 as well.
>
>TIA
An object of takes on the data session that is current at the time of creation. So the object grabs a handle on "dataenvironment" which does not disappear until the last thing hanging on to it is released.
BTW this makes object procedures fairly tricky, because they only see the one dataenvironment. Personally I like to keep procedures that generically handle data files in a procedure library (the old fashioned way), where they see the current data session, rather than in a object, such as the application object.
HTH
Previous
Next
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