Solved

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

Posted on 2009-05-17
2
215 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 36

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now