Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TlistView Items into a memo

97 views
Skip to first unread message

Paul Wiggers

unread,
May 6, 2002, 9:46:28 AM5/6/02
to

Hello,

How do i get the values of a ListView component(with 3 collums) that is on a form into a memo field that is in a table
we just can't seem to figure it out
thanks

Paul

Gerbert Koppelman

unread,
May 6, 2002, 10:15:01 AM5/6/02
to
Hello Paul,
iCount: integer;

Try this:
For iCount := 0 to ListView1.Items.Count-1 do
begin
// The first column:
slFiles.Add(ListView1.Items.Item[iCount].Caption);
// The second column:
slFiles.Add(ListView1.Items.Item[iCount].SubItems.Strings[0]);
end;

--

Gerbert Koppelman

jacob muntner

unread,
May 6, 2002, 12:17:03 PM5/6/02
to
This procedure was posted by Peter Below(TeamB) sometime ago,
and is intended to SaveToFile the Listview. you may try to change
the line(see below) for assigning it to the DbMemo(?).
now, having bad experience with the 'text' property of some DataAware
controls(cannot assign directly to DbEdit.text!), i hope DbMemo works
"normally"(never tried). good luck!
----
Procedure SaveListviewStrings( listview: TLIstview; const filename:
String );
Var
sl: TStringlist;
S: String;
i, k: Integer;
item: TLIstItem;
Begin { SaveListviewStrings }
Assert( Assigned( listview ));
If listview.ViewStyle <> vsReport Then
raise Exception.CreateFmt( eInvalidViewstyle,
['SaveListviewStrings', listview.name ] );

sl:= TStringlist.Create;
try
For i := 0 To listview.items.count-1 Do Begin
item := listview.Items[i];
S:= item.Caption;
For k := 0 To item.SubItems.Count-1 Do
S:= S + #9 + item.Subitems[k];
sl.Add( S );
End; { For }
sl.SaveToFile( filename ); (* DbMemo.Lines.Assign(SL); *)
finally
sl.free
end;
End; { SaveListviewStrings }
-------
HTH
jacob

"Paul Wiggers" <Bor...@wish.nl> wrote in message news:3cd68934$1_1@dnews...

Paul Wiggers

unread,
May 7, 2002, 4:31:06 AM5/7/02
to

Both thanks for your response but for some reason they do not want to work..don't know why

with the response from jacob i get an access violation in module (some number)
and with the other response he cannot add the values to the memo :(

do you have some other suggestions?

thanks

Paul Wiggers

jacob muntner

unread,
May 7, 2002, 9:35:28 AM5/7/02
to
Paul, forgot one thing. should be:- TMyForm.SaveListviewStrings(), where
MyForm owns DbMemo. in order to use DbMemo in the procedure, which
is a stand alone as i posted, you should declare it in the private section
of
MyForm class. did you add it?
one more thing, maybe you are not in an Edit/Append mode while calling the
proc?
if nothing helps, try the Database NG.
-------
jacob

"Paul Wiggers" <Bor...@wish.nl> wrote in message news:3cd790ca$1_2@dnews...

0 new messages