1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, XPMan, Menus;
type
TForm1 = class(TForm)
XPManifest1: TXPManifest;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
Memo2: TMemo;
Button1: TButton;
Label5: TLabel;
GroupBox2: TGroupBox;
Button2: TButton;
ComboBox1: TComboBox;
Label6: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
rec=record n,d:string[255];s,t:tstrings; end;
var
Form1: TForm1;
x:rec;
f:file of rec;
implementation
{$R *.dfm}
function up(ch:string):string;
var i:integer;
begin
for i:=1 to length(ch) do ch[i]:=upcase(ch[i]);
up:=ch;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
assignfile(f,'c:\GP\Base De Données.dat');
{$i-}
reset(f);
{$i+}
if ioresult<>0 then
begin
mkdir('c:\GP');
rewrite(f);
end;
reset(f);
while not eof(f) do
begin
read(f,x);
combobox1.Items.Add(x.n);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
reset(f);
while not eof(f) do read(f,x);
x.n:=edit1.text;
x.d:=edit2.text;
x.s:=memo1.Lines;
x.t:=memo2.Lines;
write(f,x);
combobox1.Items.Clear;
reset(f);
while not eof(f) do
begin
read(f,x);
combobox1.Items.Add(x.n);
end;
edit1.text:='';
edit2.text:='';
memo1.Lines.Clear;
memo2.Lines.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
var b:boolean;
begin
b:=false;
reset(f);
while (not eof(f)) and (b=false) do
begin
read(f,x);
if up(combobox1.text)=up(x.n) then b:=true;
end;
edit1.text:=x.n;
edit2.text:=x.d;
memo1.Lines:=x.s;
end;
end. |
Partager