TForm1.ListBox2Click

 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
procedure TForm1.ListBox2Click(Sender: TObject);
var
s: string;
i: integer;
f: file of isp;
a: isp;
begin
i:=1;
AssignFile(f, 'isp.txt');
reset(f);
while not eof(f) do
begin
Read(F, a);
md[i]:=a;
i:=i+1;
end;
if listbox2.Itemindex=-1 then
listbox2.Itemindex:=0;
s:=Listbox2.Items.Strings[listbox2.itemindex];
for i:=1 to 10 do
begin
if s=mD[i].name then
begin
Label4.Caption:=md[i].godn;
Label5.Caption:=md[i].kol;
Label6.Caption:=md[i].str;
memo2.Text:=md[i].opisanie;
Image1.Picture.LoadFromFile(md[i].foto);
if listbox2.ItemIndex<>-1 then image1.Visible:=true;
end;
end;
end;