unit TStringListSorted;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: TStringListSorted
// Property: Classes.TStringList.Sorted
// Method: Classes.TStrings.AddStrings

// BeginCode
{
This example uses a list box on a form. When the application
runs, a string list object is created and three strings are
added to it. The strings are sorted and added to the list
box, where they appear in their sorted order:
} 
procedure TForm1.FormCreate(Sender: TObject);
var
  MyList: TStringList;
begin
  MyList := TStringList.Create;
  MyList.Add('Plants');
  MyList.Add('Animals');
  MyList.Add('Minerals');
  MyList.Sorted := True;
  ListBox1.Items.AddStrings(MyList);
  MyList.Free;
end;
// EndCode
// EndExample: TStringListSorted
end.
