procedure TForm1.Button1Click(Sender: TObject);
 var
  str:string;
begin
  str:=Edit1.text;
  if combobox1.Items.IndexOf(str)=-1 then
     combobox1.Items.Add(str);
end;
在窗体第一次创建时添加同样道理!

解决方案 »

  1.   

    好像可以修改combobox的某个属性,不允许重复。也许可以。
      

  2.   

    错了,stringList有个属性:不允许重复。你可以先申请一个stringlist变量,把这些字符读到stringList里。把stringList的属性设为不允许重复。它就会自动过滤掉重复的。然后,再把stringlist拷到combobox里。我以前做24点游戏时这么做过。
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
     var
      i,j:integer;
    begin
        j:=i+1;
        if combobox1.items.indexof(i)<>combobox1.items.indexof(j) then
          combobox1.Items.add; 
    end;