谢谢。

解决方案 »

  1.   

    if ComboBox1.IndexOf(strText)>0 then 
      //存在
      

  2.   

    错了,是
    if ComboBox1.Items.IndexOf(strText)>0 then
      

  3.   

    呵呵最好加上Trim
    if ComboBox1.Items.IndexOf(Trim(strText))>0 then
      

  4.   

    if ComboBox1.Items.IndexOf(strText)>=0 then
      

  5.   

    路过,又学到东西了。我以前都是这样做的。
    var
      i:integer;
      indexC:boolean;
    begin
      indexC:=false; 
      for i:=0 to ComboBox1.Items.Count-1 do
        if strText=ComboBox1.Items[i] then 
          begin 
          MessageDlg('值已存在',mtinformation,[mbYes],0);
          indexC:=true;
          break;
          end;
      if indexC=false then MessageDlg('值不存在',mtinformation,[mbYes],0);   
    end;