Сортировать список по алфавиту



Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{
You need a TListBox and a TButton.
With a few modifications, you can use it with any variable
compatible with a TStringList.
If you change the operator "<"  for a ">" in the 'if' clause
below, the order will be reversed
}
procedure TForm1.Button1Click(Sender: TObject);
var
i, x: Integer;
begin
for i := 0 to (ListBox1.Items.Count - 1) do
for x := 0 to (ListBox1.Items.Count - 1) do
if (ListBox1.Items[x] < ListBox1.Items[i]) and (x > i) then
begin
ListBox1.Items.Insert(i, ListBox1.Items[x]);
ListBox1.Items.Delete(x + 1);
end;
end;

Далее: Сортировка ListView в режиме vsReport при нажатии на заголовок колонки »»