Nic mnie tak nie bawi, jak BURDEL w kodzie a potem następuje zdziwienie dlaczego nie działa. Nie działa bo nie ma jak dojść do logiki wykonania programu. Przeanalizuj sobie mój kod i wyciągnij wnioski.
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
with Memo1.Lines, StringGrid1 do
begin
Clear();
for i := 1 to RowCount - 1 do
begin
if Edit1.text = Cells[3,i] then
begin
Add(Cells[1,i]+' '+Cells[2,i]);
Add('Numer seryjny: '+Cells[3,i]);
Add('Ilość: '+Cells[4,i]+' szt.');
Add('Zakupiono za: '+Cells[5,i]+' zl');
Add('Sprzedano za: '+Cells[6,i]+' zl');
Add('Zysk wynosi: '+Cells[7,i]+' zl');
Add('Info: '+Cells[8,i]);
Break;
end
else
begin
Clear();
Add('Przedmiot o tym numerze nie zostal znaleziony');
end;
end;
end;
end;
lub
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
with Memo1.Lines, StringGrid1 do
begin
Clear();
for i := 1 to RowCount - 1 do
begin
if Edit1.text = Cells[3,i] then
begin
Add(Format('%s %s', [Cells[1,i], Cells[2,i]]));
Add(Format('Numer seryjny: %s', [Cells[3,i]]));
Add(Format('Ilość: %s szt.', [Cells[4,i]]));
Add(Format('Zakupiono za: %s zl', [Cells[5,i]]));
Add(Format('Sprzedano za: %s zl', [Cells[6,i]]));
Add(Format('Zysk wynosi: %s zl', [Cells[7,i]]));
Add(Format('Info: %s', [Cells[8,i]]));
Break;
end
else
begin
Clear();
Add('Przedmiot o tym numerze nie zostal znaleziony');
end;
end;
end;
end;