[DUG] Variabels stored

Alister Christie alister at salespartner.co.nz
Thu Jan 20 16:22:27 NZDT 2011


Yes, you probably want to declare the variables in the TForm, then you 
will be able to access them from any of the forms methods.  Something 
like the following.

type
   TForm11 = class(TForm)
     Button1: TButton;
     procedure Button1Click(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
     MyString : string;
   end;

var
   Form11: TForm11;

implementation

{$R *.dfm}

procedure TForm11.Button1Click(Sender: TObject);
begin
   MyString := 'Hello, world!';
end;

You can then access the MyString from any method on the form.  Depending 
on how you need to access MyString, you can place it in the public or 
private section (or protected).

Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
http://www.salespartner.co.nz
PO Box 13085
Johnsonville
Wellington


On 20/01/2011 3:45 p.m., Marshland Engineering wrote:
> Is there a way to store variables so I can use them from one procedure 
> to another?
> I have been currently storing them in hidden edit.text boxes on the 
> form but there must be a better way.
> Cheers Wallace
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110120/9cde2574/attachment.html 


More information about the Delphi mailing list