Copy TStringList to TListBox
- From: Arjan <arjan@xxxxxxxxxxxxxxx>
- Date: Thu, 02 Oct 2008 23:39:54 +0100
Hello all,
I have a TStringList containing some strings, with associated objects.
I wish to copy this list to a TListBox, so that the Listbox contains
a separate copy of the Stringlist items (including the objects).
I use Assign, but it seems that this only assigns pointers to the original
objects in the Stringlist instead of copying them to new objects:
ListBox1.Clear;
ListBox1.Items.Assign(StringList1);
StringList1.Clear; //this changes >=1 objects in ListBox1!
(The objects contain a record with string fields, I can watch them in the
debugger. One of the strings of at least one of the objects changes.)
Am I missing something basic?
Regards,
Arjan
.
- Follow-Ups:
- Re: Copy TStringList to TListBox
- From: alanglloyd@xxxxxxx
- Re: Copy TStringList to TListBox
- From: Jamie
- Re: Copy TStringList to TListBox
- From: Hans-Peter Diettrich
- Re: Copy TStringList to TListBox
- Next by Date: Re: Copy TStringList to TListBox
- Next by thread: Re: Copy TStringList to TListBox
- Index(es):
Relevant Pages
|