type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i:integer;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
j:integer;
begin
inc(i);
j:=Listbox1.Items.Add(format('this is %d',[i]));
listbox1.ItemIndex :=j;
end;