unit UmdListe;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    ListBox1: TListBox;
    Naechster: TButton;
    Ausgabe: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Button1: TButton;
    Edit3: TEdit;
    Label4: TLabel;
    Button2: TButton;
    procedure NaechsterClick(Sender: TObject);
    procedure AusgabeClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  Kerl:array[1..10,1..3]of string;
  n,m,i:integer;
implementation

{$R *.DFM}

procedure TForm1.NaechsterClick(Sender: TObject);
begin
n:=n+1;
kerl[n,1]:=edit1.text;
kerl[n,2]:=edit2.text;
kerl[n,3]:=edit3.text;
edit1.clear;
edit2.clear;
edit3.clear;
label3.caption:='Schüler Nr. '+ inttostr(n+1);
edit1.setfocus;
end;

procedure TForm1.AusgabeClick(Sender: TObject);
begin
for i:=1 to n do
listbox1.items.add (inttostr(i)+'. Der Schüler '+kerl[i,1]+', geb.'+kerl[i,3]+',' + ' wohnt in '+kerl[i,2]+'.');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
n:=0;
listbox1.clear;
edit1.clear;
edit2.clear;
edit3.clear;
label3.caption:= 'Schüler Nr. 1' ;
ZeroMemory(@Kerl,SizeOf(Kerl)); //Leeren des arrays "Kerl"
edit1.setfocus;
end;

end.
