Solved

create a var in a unit and free again  using begin end block

Posted on 2009-05-17
2
224 Views
Last Modified: 2012-05-07
I know there is a solution to create a var and init at program start and free adain at close/ terminiate event  with some lines of code between the begin end block of a unit
0
Comment
Question by:BdLm
2 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 250 total points
ID: 24407651
something like this ?


unit uTest;
 
interface
 
uses Classes;
 
procedure AddTest(aText: string);
procedure DelTest(aText: string);
 
implementation
 
var mList: TStrings;
 
procedure AddTest(aText: string);
begin
  mList.Add(aText);
end;
 
procedure DelTest(aText: string);
begin
  mList.Delete(mList.IndexOf(aText));
end;
 
initialization
  mList := TStringList.Create;
finalization
  FreeAndNil(mList);
end.

Open in new window

0
 
LVL 8

Author Closing Comment

by:BdLm
ID: 31582417
thanks I forgot this one ,
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert a string into a TDateTime 5 61
Delphi and Access based Enumeration 9 64
Dev express lookupcombo 3 28
Twebbrowser add css to the header 3 25
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question