?
Solved

using  TCollection

Posted on 2003-03-13
4
Medium Priority
?
836 Views
Last Modified: 2008-01-09
Hello world!

I need a litle example of
using TCollection!

I made this!

procedure TForm1.Button1Click(Sender: TObject);
var    sl    : TStringList;
       col   : TCollection;
       ITcol : TCollectionItem;
       i : Byte;
begin
  try
    col   := TCollection.Create(TCollectionItemClass(TStringList));
    sl    := TStringList.Create;
    for i:=0 to 3 do sl.Add('String'+IntToStr(i));          
     for i:=0 to 9 do
        //HOW to add an item (for example my 'sl') to my 'col'
  finally
    sl.free;
  end;
end;

thanks
0
Comment
Question by:sica79
[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
4 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 120 total points
ID: 8127260
hi,
TCollection supposed to keep items inherited from TCollectionItem.
You can't add something else there without problems.

If you have to keep string list in TCollection, then you have to create your own TCollectionItem and place TStringList there as a property.

_____
Igor
0
 

Expert Comment

by:CleanupPing
ID: 9316798
sica79:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

765 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