Einzelnen Beitrag anzeigen

Rob.BloodWorks

Registriert seit: 15. Okt 2010
8 Beiträge
 
Delphi 6 Personal
 
#1

Adressbuch speichern und laden

  Alt 16. Okt 2010, 21:41
Hallo,
ich fang gerade mit delphi an und bastel mir erst mal ein adressbuch.funktioniert auch alles soweit außer das speichern und laden.Ich hab schon in delphi büchern und im internet geguckt aber finde nix
und wollt mal fragen ob mir einer von euch helfen kann.
hier der code:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, FileCtrl, jpeg, ExtDlgs;

type PersonID = Record
                Nachname, Vorname: string [50];
                Strasse: string [70];
                PLZ: String [6 ];
                Ort: string [30];
                Geburtstag: string [10];
                Telefonnummer: string [30];
                Handynummer: string [40];
                EMail: string [60];
                Geschlecht: string [8 ];
end;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button3: TButton;
    Button5: TButton;
    Button7: TButton;
    Button9: TButton;
    Button11: TButton;
    Button16: TButton;
    Panel1: TPanel;
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Button17: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Label11: TLabel;
    Label12: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Button2: TButton;
    Edit11: TEdit;
    Label13: TLabel;
    Button4: TButton;
    Button6: TButton;
    Button8: TButton;
    Button10: TButton;
    Button12: TButton;
    Button13: TButton;
    Button14: TButton;
    Button15: TButton;
    Panel2: TPanel;
    Label14: TLabel;
    Button18: TButton;
    Button19: TButton;
    OpenPictureDialog1: TOpenPictureDialog;
    Button20: TButton;
    SaveDialog1: TSaveDialog;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button16Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button17Click(Sender: TObject);
    procedure Label3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure Button13Click(Sender: TObject);
    procedure Button14Click(Sender: TObject);
    procedure Button15Click(Sender: TObject);
    procedure Button20Click(Sender: TObject);
    procedure Button18Click(Sender: TObject);
    procedure Button19Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var Person: PersonID;
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
color:=clred;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
color:=clgreen;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
color:=clblue;
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
color:=clblack;
end;

procedure TForm1.Button16Click(Sender: TObject);
begin
color:=clyellow;
end;

procedure TForm1.Button11Click(Sender: TObject);
begin
color:=clgray;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
color:=clwhite;
end;

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

procedure TForm1.Label3Click(Sender: TObject);
begin
color:=clwhite;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
color:=clsilver;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
color:=clmaroon;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
color:=clnavy;
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
color:=clpurple;
end;

procedure TForm1.Button10Click(Sender: TObject);
begin
color:=clmoneygreen;
end;

procedure TForm1.Button12Click(Sender: TObject);
begin
color:=clolive;
end;

procedure TForm1.Button13Click(Sender: TObject);
begin
color:=clfuchsia;
end;

procedure TForm1.Button14Click(Sender: TObject);
begin
color:=claqua;
end;

procedure TForm1.Button15Click(Sender: TObject);
begin
color:=clteal;
end;

procedure TForm1.Button20Click(Sender: TObject);
var open :TOpenPictureDialog;
begin
   try
     open := TOpenPictureDialog.Create(self);
     open.InitialDir := ExtractFilePath(Application.ExeName);
    IF open.Execute THEN
       image1.picture.loadfromfile(open.filename);
   finally
    open.Free;
   end;
end;

procedure TForm1.Button18Click(Sender: TObject);
begin
        if SaveDialog1.Execute then
begin
 if FileExists(SaveDialog1.FileName)Then
  if MessageDlg('The File'+ SaveDialog1.FileName
     +'already exists. Overwrite?',
     mtConfirmation,[mbYes, mbNo],0)<> mrYes Then
    Exit;


end;

end;

procedure TForm1.Button19Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
     TRY
       OpenDialog1.Filename;
     EXCEPT
       ShowMessage ('Fehler beim Laden der Datei!');

     END;
    end;

end.
Danke schon mal an alle die mir helfen

Geändert von mkinzler (17. Okt 2010 um 12:49 Uhr) Grund: Delphi-Tag eingefügt
  Mit Zitat antworten Zitat