Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

20 Experts available now in Live!

Get 1:1 Help Now