Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

using  TCollection

Posted on 2003-03-13
4
Medium Priority
?
847 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
2 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

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…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

564 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