unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Button2: TButton;
    ListBox1: TListBox;
    SaveDialog1: TSaveDialog;
    SaveDialog2: TSaveDialog;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 SaveDialog1.InitialDir:=GetCurrentDir;
 if Savedialog1.Execute then Memo1.Lines.SaveToFile(Savedialog1.FileName);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   SaveDialog2.InitialDir:=GetCurrentDir;
   if SaveDialog2.Execute then
     ListBox1.Items.SaveToFile(SaveDialog2.FileName)
   else ShowMessage('Naciśnięto klawisz Anuluj!');
end;

end.
