资 源 简 介
Delphi在TListView中显示数据库,ListView控件的简单用法,在日常的编程开发中,这个比较常用 。
self.ListView1.ViewStyle:=vsReport;
for i:=0 to Query1.FieldCount-1 do
begin
TempColumn:=self.ListView1.Columns.Add;
TempColumn.Caption:=Query1.Fields[i].FieldName;
end;
Query1.First;
while not Query1.Eof do
begin
TempItem:=self.ListView1.Items.Add;
TempItem.Caption:=Query1.Fields[0].AsString;
for i:=1 to Query1.FieldCount-1 do
begin
TempItem.SubItems.Add(Query1.Fields[i].AsString);
end;
Query1.Next;
end;