Home Adding Items in ListView RAD Studio Delphi 10.2
Reply: 0

Adding Items in ListView RAD Studio Delphi 10.2

J1MAV1GN0N
1#
J1MAV1GN0N Published in 2017-09-12 17:20:59Z

I want to show a list with TListView, generated with data out of my database. But my code is only showing one item in the list.

It should look like a short List with Text like Adress, Name1, Name1 just like on this picture:

The Code for the view on the pic:

procedure TForm2.RefreshButton1Click(Sender: TObject); 
var
 queryListClient : TFDQuery;
 ItemAdd : TListViewItem;
begin
  queryListClient := TFDQuery.Create(Nil);
  queryListClient.Connection := FDConnection1;

  queryListClient.SQL.Clear;
  queryListClient.SQL.Add('Select * from Projekt ORDER by ProjNr');
  queryListClient.Open();
  queryListClient.First;

  List_Clients1.Items.Clear;
  List_Clients1.BeginUpdate;
  while Not queryListClient.Eof do
  begin
    ItemAdd := List_Clients1.Items.Add;
    ItemAdd.Text := queryListClient.FieldByName('Name1').AsString;
    ItemAdd.Detail := queryListClient.FieldByName('Name2').AsString;
    queryListClient.Next;
  end;
  List_Clients1.EndUpdate;
  queryListClient.Close;
  queryListClient.Free;
end;

What it looks like now:

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301216 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO