unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
Type
TNamenArray=Array
of String;
var
NamenArray:TNamenArray;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
SetLength(NamenArray , High(NamenArray) + 2);
// High eines Leeren Array's ist -1
NamenArray[High(NamenArray)] := Edit1.Text;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:Integer;
begin
for I := Low(NamenArray)
to High(NamenArray)
do Showmessage(NamenArray[i]);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i:Integer;
s:
String;
begin
for I := Low(NamenArray)
to High(NamenArray)
do s := s + IntToStr(i) + '
: ' + NamenArray[i] + #13#10;
Showmessage(s);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
SetLength(NamenArray,0);
// Array leeren
end;
end.