![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Ну неужели никто не знает как брать данные из ListView и класть их куда надо. [D6, Win95/98]
Dmitriy_R © (2002-01-07 17:39:00)Ну хоть кто нить подскажет где грабли на которые я наступаю.
function TFormList.SaveList(FileName: AnsiString):integer;
Var SubItems: TStrings;
I: integer;
begin
Memo.Lines.Clear();
For I := 0 to ListView.Items.Count do
begin
SubItems := ListView.Items.Item[I].SubItems;
Memo.Lines.Add(SubItems.Strings[1]);
Memo.Lines.Add(SubItems.Strings[2]);
Memo.Lines.Add(SubItems.Strings[3]);
end;
Далее идет сохранение файла...
end;
XeN (2002-01-07 19:06:00) [1]var i:integer;
......
if listview.Items.Count < 0 then exit;
Memo.Lines.Clear();
For i := 0 to listview.Items.Count - 1 do
Begin
Memo.Lines.add(listview.Items.Item[i].Caption);
Memo.Lines.add(listview.Items.Item[i].SubItems.strings[0]);
Memo.Lines.add(listview.Items.Item[i].SubItems.strings[1]);
Memo.Lines.add(listview.Items.Item[i].SubItems.strings[2]);
end;
......
А можно и без memo, так сделать...
Procedure SaveALL(filename:string);
var
i:integer;
ts:tstringlist;
begin
if listview.Items.Count < 0 then exit;
try
ts := tstringlist.create;
For i := 0 to listview.Items.Count - 1 do
Begin
ts.add(listview.Items.Item[i].Caption);
ts.add(listview.Items.Item[i].SubItems.strings[0]);
ts.add(listview.Items.Item[i].SubItems.strings[1]);
ts.add(listview.Items.Item[i].SubItems.strings[2]);
end;
ts.savetofile(filename);
ts.free;
except halt; end;