Hi,
I've created a listbox and am trying to use a bubble sort to output the list of names in sorted order.
I've tried various methods on the listbox to get the 'names' entered... but not compiling.
procedure TForm1.btnSortClick(Sender: TObject);
var NoMoreSwaps:boolean;
Temp:string;
count:integer;
begin
Repeat
For count:= 1 to lstName.items.count - 1
DO
If lstName.items.Names[count] > lstName.items.names[count+1]
THen
Begin
NoMoreSwaps:=false;
Temp:=lstName.items.Names[count];
lstName.items.names[count]:=lstName.items.names[count+1];
lstName.items.names[count + 1]:=temp;
End;
Until NoMoreSwaps = true;
end;
end.
I'm guessing lstName.items.names is the wrong method to access a value in the listbox.
Any ideas?
thanks, tiny