| Subject |
Re: timer class |
| From |
Mustansir Ghor <mustan31@hotmail.com> |
| Date |
Sun, 24 Jul 2022 14:28:39 -0400 |
| Newsgroups |
dbase.getting-started |
Dear Mervyn Sir
I agree with your explanation and was aware of it but I am at development stage. Here on IDE i use design and run icons to test my form. So thought may be onDesign form event or somewhere I could close the form so that I dont get disrupted with the error.
Yes as Andy says learning process never ends.
Regards to all
Mustansir
Mervyn Bick Wrote:
> On 2022/07/24 12:43, Mustansir Ghor wrote:
> > Dear All
> >
> > One more issue has come up with me.
> >
> > After using a timer class in the form ,a statement form.databasename.emptytable(" xyz") says file is in use by another on a second attemp on form run. After 1st run when I click form design button I think due to timer, the database must not have closed.
> >
> > Can anybody suggest if we rectify this problem.
>
> It is extremely important to manually deactivate any timer object on a
> form in the form's canClose or onClose event handler. If you don't
> deactivate it it keeps on ticking away in memory until you actually
> close dBASE. Type help timer class in the Command Panel and then
> click on the link to the example at the top of the page.
>
> Most objects on a form are closed and released automatically when a form
> is closed. As an aside, it is good programming (although too many
> programmers seem to not do this) to deactivate all objects manually
> before closing a form.
>
> If all objects on the form are inactive when the form is closed Windows
> will release the form and clear it from memory. If anything in the form
> accesses an active object in memory then Windows keeps the form in
> memory. If you open the form a second time Windows doesn't load and run
> the code again it simply uses the code already in memory.
>
> The emptyTable() method of a database object requires exclusive use of
> the table. This means that in your form the method has to be executed
> before the query that accesses the table is made active. When Windows
> executes the copy kept in memory the second time round the query is
> active because it was active when the form was closed. The table is,
> therefore, in use and the emptyTable() method can't be executed.
>
> Mervyn.
>
>
>
>
>
>
>
|
|