Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form's problem
Message
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00216559
Message ID:
00219359
Views:
26
Nadya,

> Ok. Where do you usually clean the garbige (I mean, close cursors, etc.)? In which method? I do it now in Unload method and in Release method of my main form I just release all my forms (main and 2 child).

I never Hide()/Show() forms. All of my systems use modeless forms that don't take very long to instantiate, so I just allow the form to normally destruct. If I create a cursor in Load() or Init() I get rid of it in Destroy().

>I modified my code a little:
>In my main program I declare 2 global variables: chForm1 and chForm2. In the Init method of each of my child form I set chForm1(or 2)=THISFORM and in RELEASE method of my main form I just wrote chForm1(or 2).RELEASE() Of course, I check before is chForm1 an object and NOT NULL. This code also works fine. (Before I tried your code and Fred's code, they also worked fine)

It's generally not a good design to have global memvars around, it limits your flexibility to extend your system easily. You might want to look at creating a FormsManager object to help you deal with the issues.

> Now I place tableupdate() into unload method of my form (it was before in release method) and I don't see this error. But I am not sure that this is a solution.
>
> What do you think about this?

If you have data buffering I'm not sure that you want to delay the commit of the data until your form is released, which maybe a long time after it's hidden. You might want to do the tableupdate() in the Hide().
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform