unit Unit1;
interface
uses
SysUtils, WinTypes,WinProcs, Messages, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Panel1: TPanel;
Edit1Name: TEdit;
Edit2Vorname: TEdit;
Edit3Geburtsdatum: TEdit;
Edit4Strasse: TEdit;
Edit5Ort: TEdit;
Edit6Telefonnummer: TEdit;
Edit7Firma: TEdit;
Edit8Anzahl: TEdit;
Edit9Suche: TEdit;
ListBoxText: TListBox;
Button1Laden: TButton;
Button2Hinzufuegen: TButton;
Button3Aendern: TButton;
Button4Loeschen: TButton;
Button5AllesLoeschen: TButton;
Button6Sortieren: TButton;
Button7Zaehlen: TButton;
Button8Speichern: TButton;
Button9Suche: TButton;
Button10Schlie: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Edit10Aendern: TEdit;
Label13: TLabel;
Label14: TLabel;
procedure ListBoxTextMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2HinzufuegenClick(Sender: TObject);
procedure Button10SchlieClick(Sender: TObject);
procedure Button5AllesLoeschenClick(Sender: TObject);
procedure Button7ZaehlenClick(Sender: TObject);
procedure Button4LoeschenClick(Sender: TObject);
procedure Button8SpeichernClick(Sender: TObject);
procedure Button1LadenClick(Sender: TObject);
procedure Button6SortierenClick(Sender: TObject);
{ procedure Button3AendernClick(Sender: TObject); }
procedure Button9SucheClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ListBoxTextMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Button4Loeschen.Enabled:=ListBoxText.ItemIndex>=0;
end;
procedure TForm1.Button2HinzufuegenClick(Sender: TObject);
begin
ListBoxText.Items.Add(Edit1Name.text +'
,'+Edit2Vorname.text +'
geb.:'+
Edit3Geburtsdatum.text + '
'+Edit4Strasse.text +'
'+Edit5Ort.text +
'
Tel.:'+Edit6Telefonnummer.text +'
'+Edit7Firma.text);
Edit1Name.text:='
';
Edit2Vorname.text:='
';
Edit3Geburtsdatum.text:='
';
Edit4Strasse.text:='
';
Edit5Ort.text:='
';
Edit6Telefonnummer.text:='
';
Edit7Firma.text:='
';
Button4Loeschen.Enabled:=TRUE;
end;
procedure TForm1.Button10SchlieClick(Sender: TObject);
begin
close;
end;
procedure TForm1.Button5AllesLoeschenClick(Sender: TObject);
begin
ListBoxText.Items.Clear;
Button4Loeschen.Enabled:=TRUE;
Button5AllesLoeschen.Enabled:=TRUE;
end;
procedure TForm1.Button7ZaehlenClick(Sender: TObject);
var anzahl:integer;
begin
anzahl:=ListBoxText.Items.Count;
Edit8Anzahl.Text:=IntToStr(anzahl);
end;
procedure TForm1.Button4LoeschenClick(Sender: TObject);
begin
if ListBoxText.ItemIndex>-1
then ListBoxText.Items.Delete(ListBoxText.ItemIndex);
Button4Loeschen.Enabled:=TRUE;
Button5AllesLoeschen.Enabled:=ListBoxText.Items.Count>=1;
end;
procedure TForm1.Button8SpeichernClick(Sender: TObject);
begin
ListBoxText.Items.SaveToFile('
Telefon.dat');
end;
procedure TForm1.Button1LadenClick(Sender: TObject);
begin
ListBoxText.Items.LoadFromFile('
Telefon.dat');
end;
procedure TForm1.Button6SortierenClick(Sender: TObject);
begin
ListBoxText.Sorted:=TRUE;
end;
{procedure TForm1.Button3AendernClick(Sender: TObject);
var i: integer;
begin
FOR i := 0 TO ListBoxText.Items.Count - 1 DO
IF ListBoxText.Items[i] >-1 THEN
if StrToInt(Edit2.Text) = ListBox1.Items[i] THEN ListBox1.Items[i] := 0;
Edit10Aendern.Text:=(i);
ListBoxText.Items.Add(Edit10Aendern.text);
Edit10Aendern.Text:='';
end; }
procedure TForm1.Button9SucheClick(Sender: TObject);
begin
ListBoxText.ItemIndex := ListBoxText.Items.IndexOf(Edit9Suche.Text);
end;
end.