'Avoid blank Items in ListView Delphi 10.4.2
I'm trying to display data from TFDQuery to TListView, but I don't want to use a Data Binding.
When I fetch the data, I have a blank Item between every record. How can I avoid these blank items?
DM.Qdomains.Connection := DM.Conn;
DM.Qdomains.SQL.Text := 'SELECT * FROM domains';
DM.Qdomains.Active := True;
DM.Qdomains.First;
try
while not DM.Qdomains.Eof do
begin
with DomainsListView.Items.Add do
begin
DomainsListView.Items.Add.Data['domain'] := DM.Qdomains.FieldByName('domain').AsString;
end;
DM.Qdomains.Next;
end;
finally
DM.Qdomains.Free;
end;
Solution 1:[1]
I assume you don't have this single text, so I think your ListView appearance is Dynamic ? I agree Remy's response, but I can't but ask why you don't use Livebindings to fill your ListView (so easy and no code) ?
(sorry to put this as an answer, but low reputation => no comment nor vote)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SergeGirard |

