Delphi TStringList not allowing duplicates


[ Related Articles and Replies ] [ Delphi Forum ] [ Delphi Tutorials ]

Posted by BeckyR on February 05, 2002 at 15:22:02:

How do I use the duplicates property to raise an exception when a duplicate string is added to a Delphi stringlist?
This is some of the code I have started with but no exception is being raised so I am sure I am missing something. Thanks.

for iTemp := 0 to frmData.sgClasses.Rowcount - 1 do
begin
  try
    slGeneratedTemp.Add(frmData.sgClasses.Cells[11,iTemp]);
  except on EStringListError do showmessage('duplicate scan codes');
  end;
end; 
 

Related Articles and Replies:


[ Related Articles and Replies ] [ Delphi Forum ] [ Delphi Tutorials ]