procedure TfoMain.BtnAllesZeigenClick(Sender: TObject);
var
Item: TListItem;
begin
with AdsQuery1
do
begin
Active := False;
SQL.Text := '
SELECT * FROM Daten';
Active := True;
First;
while not Eof
do
begin
Item := LvwInfo.Items.Add;
Item.Caption := FieldByName('
Nr').AsString;
Item.SubItems.Add(FieldByName('
Bezeichnung').AsString);
Item.SubItems.Add(FieldByName('
Datum').AsString);
Item.SubItems.Add(FieldByName('
Preis').AsString);
Next;
end;
end;
PnlCounter.Caption := IntToStr(LvwInfo.Items.Count);
end;
procedure TfoMain.LvwInfoSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
var
I: Integer;
begin
if ( Selected
and (LvwInfo.ItemIndex > -1) )
then
begin
for I := 0
to LvwInfo.Items.Count - 1
do
begin
EdtIndex.Text := LvwInfo.Selected.Caption;
EdtBezeichnung.Text := LvwInfo.Selected.SubItems[0];
EdtDatum.Text := LvwInfo.Selected.SubItems[1];
EdtPreis.Text := LvwInfo.Selected.SubItems[2];
end;
end;
end;