if listbox1.Items.Count>2 then
begin
     
     for t:=1 to  i-1   do       if shuzu1[t]=shuzu1[i] then
       showmessage('重复的进程名')
       else
        t:=t+1;
     end
     
end;
其中i=listbox1.items.count  。shuzu1 里面放的就是Items 。

解决方案 »

  1.   

    for循环中不能为t赋值,你改用其它变量吧
      

  2.   

    t:=1
    while t<=i-1 do
    begin
      if shuzu1[t]=shuzu1[i] then
      begin
        showmessage('重复的进程名')
        break;
      end;
      t:=t+1;
    end;
      

  3.   


    if listbox1.Items.Count>2 then
    begin
        
      for t:=1 to i-1 do  if shuzu1[t]=shuzu1[i] then
      showmessage('重复的进程名');
      end
        
    end;
      

  4.   

         for t:=1 to listbox1.Items.Count-2 do
           begin
            if shuzu1[t]=shuzu1[i-1] then
            showmessage('重复的进程名')
            else
            t:=t+1;
         end;
    Assignment to FOR-loop variable 't'