?
Solved

Move contents from a pointer to another

Posted on 1999-07-05
4
Medium Priority
?
167 Views
Last Modified: 2010-04-06
How do I move all pointers from one TList to another?
I have a Tlist full of objects, and now I want to destroy that Tlist, after I saved the information in another (eg TList2). How do I do that?

The following code also frees Tlist2, which isn’t desirable…

TList2 := Tlist1
Tlist1.Free

/Peter
0
Comment
Question by:volavy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 90 total points
ID: 1386163
hi volavy,

seemed so, that there is no other way than
for i := 0 to list1.count - 1 do list2.add(list1[i]);

meikl
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1386164
Well, I didn't try, but can't you use this:

  list2:=TList.Create;
  list2.Assign(list1);

?

Regards, Madshi.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1386165
hi madshi,

tlist has no assign-method.
this was the first i've searched for.

meikl ;-)
0
 

Author Comment

by:volavy
ID: 1386166
It is strange that there isn’t another solution. But it will do :)

Regards
/Peter


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question