想通过选择的item作为判断条件做下一步的操作,
if item[0] 
else item[1]
但是好像没有Selected属性
不知delphi如何判断Combobox里的项目?
谢谢!

解决方案 »

  1.   

    style属性设成csDropDownList判断它的text属性
      

  2.   

    itemindex表示:
    -1,没有选择,
    0,表示第一
    1,表示第二
      

  3.   

    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
      if combobox1.Text='1' then
        begin
          application.MessageBox('1','',mb_ok);
        end
      else if combobox1.Text ='2' then
        begin
          application.MessageBox('2','',mb_ok);
        end
      else
        begin
          application.MessageBox('other','',mb_ok);
        end;
    end;
      

  4.   

    combobox1.text
    combobox1.itemindex 均可
      

  5.   

    combobox1.text
    combobox1.itemindex 均可
      

  6.   

    combobox1.text
    combobox1.itemindex 均可
      

  7.   

    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
     if ComboBox1.Text='中秋节' then
       ShowMessage('我要吃月饼!')
     else
       ShowMessage('没有别的选则.......');end;
      

  8.   

    procedure TForm1.ComboBox1Click(Sender: TObject);
    begin
       if ComboBox1.ItemIndex=0 then
        ShowMessage('中秋节');
    end;
      

  9.   

    ItemIndex:
    -1:没有选择任何项
    0:选中第一项
    1:选中第二项
    2:选中第三项
    .
    .
    .依此类推ComboBox1.Items.Strings[ComboBox1.ItemIndex];表示取选中项的值
      

  10.   

    同soft_fans
    ComboBox1.Items.Strings[ComboBox1.ItemIndex];
      

  11.   

    itemindex:表示ComboBox1中Items里的各项的序号(从0开始排序)
    ComboBox1.Items.Strings[ComboBox1.ItemIndex];//表示combobox1中当前选择的项的值(itemindex表示选择的序号)等于combobox1.text;
      

  12.   

    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
      case combobox1.itemindex of 
      0:begin
          你想做什么
        end;
      1:begin
          你想做什么
        end;
    ......
    end;
    end;combobox里的第一项是1,第二项是2,依次
      

  13.   

    他的顺序从0 开始的
    combobox.itemindex[]就可以的了