?
Solved

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

Posted on 2009-05-17
2
Medium Priority
?
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 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