SaLz
asked on
Load INI DB To Listview
Hi, does anyone know how to load an INI file into a listview.
[MyDatabase1]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
[MyDatabase2]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
[MyDatabase3]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
I would like to load [MyDatabase2] only into the listview like below.
Table | Field
Table0 Field0
Table1 Field1
Table2 Field2
Table3 Field3
Table4 Field4
thxs
[MyDatabase1]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
[MyDatabase2]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
[MyDatabase3]
Table0=Field0
Table1=Field1
Table2=Field2
Table3=Field3
Table4=Field4
I would like to load [MyDatabase2] only into the listview like below.
Table | Field
Table0 Field0
Table1 Field1
Table2 Field2
Table3 Field3
Table4 Field4
thxs
opss...wait pls...i misunderstood your question...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thxu :)))))
var
i:Integer;
s: TStrings;
l: TListItem;
C: TListColumn;
begin
s := TStringList.Create;
try
s.LoadFromFile('MyIniDb.in
with ListView1 do begin
ViewStyle := vsReport;
Columns.Clear;
C := Columns.Add;
C.Caption := 'Table';
c.AutoSize := true;
C := Columns.Add;
C.Caption := 'Field';
c.AutoSize := true;
for i := 0 to s.Count-1 do begin
l := Items.Add;
l.Caption := S.Names[i];
l.SubItems.Add(s.Values[l.
end;
end;
finally
s.free;
end;
end;
F68 ;-)