Board index » delphi » D2: TStringList.Sort not known to compiler

D2: TStringList.Sort not known to compiler

When I try to sort a stringlist using MyStringList.Sort (Just like help says)
The compiler says it doesn't know "Sort". Any ideas?
{*word*106} Ritti- r...@email.psu.edu

 

Re:D2: TStringList.Sort not known to compiler


No clues. I tried it by putting a button and two listboxes on a form.
the following code was attached to the buttonclick method, compiles and
works as expected in D2.  I added nothing to the default USES statement
(Stringlist is in CLASSES, which was present).

procedure TForm1.Button1Click(Sender: TObject);
var
slTemp : TStringList;
begin
  slTemp := Tstringlist.Create;
  with slTemp do
     try
        Sorted := false;
        Add('This');
        Add('is');
        Add('Bad');
        listbox1.items.assign(sltemp);
        Sort;
        listBox2.items.assign(sltemp);
     finally
        Free;
     end;
end;

regards,

Jeff Hutton

Quote
R Richard Ritti wrote:

> When I try to sort a stringlist using MyStringList.Sort (Just like help says)
> The compiler says it doesn't know "Sort". Any ideas?
>{*word*106} Ritti- r...@email.psu.edu

Other Threads