unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    ListBox1: TListBox;    procedure ListBox1Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}
 var
 express:string;
 //listbox
procedure TForm1.ListBox1Click(Sender: TObject);
var
i:integer;
begin
if (Sender is Tlistbox) then
  begin
  express:='';
  for i:=0 to listbox1.Items.Count-1 do
  if listbox1.Selected[i] then
  express:=express+''+listbox1.Items[i];
  label4.Caption :=express +'' + ''+ 'are selected';
  end;
end;
//exit
procedure TForm1.Button4Click(Sender: TObject);
begin
Close;
end;
//delete
procedure TForm1.Button3Click(Sender: TObject);
var
i:integer;
begin
if listbox1.SelCount< 0 then
   begin
   i:=0 ;
   repeat
   if listbox1.Selected[i] then
     begin
     listbox1.Items.Delete(i);
     i:=i-1;
     end;
     i:=i+1;
   until i=listbox1.Items.Count ;
     end;
     label4.Caption:=express+' are deleted';
     end;//insert
procedure TForm1.Button2Click(Sender: TObject);
begin
if Length(Edit1.Text )>0 then
begin
  if listbox1.Items.IndexOf(edit1.Text)<0 then
  begin
   listbox1.Items.Insert(0,edit1.Text );
   listbox1.ItemIndex:=0 ;
   label4.Caption :=edit1.Text ;
   end;
   end;
end;
 //find
procedure TForm1.Button1Click(Sender: TObject);
Var
index:integer;
begin
index:=listbox1.Items.IndexOf(edit1.Text);
if index<0  then
  MessageDlg('cannotfind'+ edit1.Text,mtinformation,[mbok],0)
   else
   label4.Caption :=edit1.Text+'is in line'+intostr(index+1); //intostr(index+1)为什么不行?end;end.