Re:Terminate without executing other Form.Creates ??
In article <326E61D6.3...@fmi.uni-passau.de>, From Christian Kaupa
<ka...@fmi.uni-passau.de>, the following was written:
Quote
> I have a problem with terminating my application. I am using several
> tables and a query which should be opened in the create event of my
> main form.
> Before that I retrieve the directory of my database from an INI-file
> an set this as the DataBase property of the datasets.
> Problem:
> If one of the datasets cannot be opened correctly (maybe the directory
> was wrong), I would like to terminate the application using
> Application.Terminate;
> But before it finally exits, the Create-procedures of all the other
> forms are called first. And since they try to access my still closed
> tables and queries I get lots of Errors.
Hi Christian(nice name!),
To save resources you should create your other forms only when you need
them but if you want them all created initially then create them from
the main form after your tables are opened. Try this in your on Create
event:
try
Table1.open;
Table2.open;
Table3.open;
Form2 := TForm2.Create(Application); {these should really be
created only when needed} Form3 := TForm3.Create(Application);
except
Application.Terminate;
end;
To do the above you will need the other units added to the uses clause
of the main form and disable the autocreate of your forms in the project
options.
God Bless,
--
Jay Schwisow j...@weldnet.com
10/23/96 19:37
---------
Using: OUI PRO 1.5.0.2 from http://www.dvorak.com