procedure TForm1.Button1Click(Sender: TObject);
         var
         str1:string;
         str2:string;
         str3:string;
begin
      str1:=edit1.Text;
      str2:=edit2.Text;
      if  combobox1.items:='加' then
      begin
        str3:=str1+str2 ;
      end;
提示then后面报错, 为什么啊?

解决方案 »

  1.   

    if  combobox1.items:='加' then 

    if  combobox1.items ='加' then 
      

  2.   

    if  combobox1.items:='加' then 
    改成
    if  combobox1.items.Strings[0]:='加' then 
      

  3.   

     if  combobox1.items:='加' then 是then 前面的错
     改为  if combobox1.text='加' then
      

  4.   

    或者直接写成
    if combobox1.text='加' then
      

  5.   

    if combobox1.text='加' then
    这样就可以了,但是为什么啊?combobox1.item 为什么不行呢?  再说 combobox里面也没有text这个属性啊还有 :=  跟 = 有什么区别啊?谢谢上面的三外解答!
      

  6.   

    combobox没有item这个属性,而是items,其内容是combobox下拉框中所有内容,类型时Tstringscombobox有text这个属性,而且是最基本的属性
    :=是赋值,=是判断