unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, uQueue;type TForm1 = class(TForm) btn1: TButton; btn2: TButton; cbb1: TComboBox; cbb2: TComboBox; mmo1: TMemo; btn3: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure btn1Click(Sender: TObject); procedure btn3Click(Sender: TObject); private { Private declarations } Queue: TQueue; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);begin Queue := TQueue.Create;end;procedure TForm1.FormDestroy(Sender: TObject);begin Queue.Free;end;procedure TForm1.btn1Click(Sender: TObject);begin Queue.AddIndustryInfo(cbb1.Text, cbb2.Text);end;procedure TForm1.btn3Click(Sender: TObject);var i: Integer;begin mmo1.Clear; for i := 0 to Queue.Count - 1 do begin mmo1.Lines.Add(PrecInfo(Queue.Objects).sTelPhone+';'+PrecInfo(Queue.Objects).sIndusName); end;end;end.//我是直接调用的你的单元 stringslist的内容显示在mmo1中,要是还不满意我也没办法啦//能全部显示出来了,查找就很简单了,你自己改下就OK了//又写了个放在你这个单元里面的函数,外面可以调这个直接查找,不过 你上面说的添加的时候 if Index<>-1 then 应该去掉 这个不能去掉,去掉后会查找出问题,具体你可以测试下 原因就是 find(AtelPhone, Index)里面的index定位为出错function TQueue.FindIndustryInfo(AtelPhone, AIndust: string): boolean;var Index: Integer;begin Result := False; if find(AtelPhone, Index) then begin if PrecInfo(objects[Index]).sIndusName = AIndust then Result := True; end;end;