Combobox控件items中输入了好几行数据,如何判断运行时选择的是第一行还是第二。。的数据,语句是什么???很急,请速回

解决方案 »

  1.   


    Combobox.ItemIndex = 0 是第一行,类推
      

  2.   

    ComboBox1.Items.IndexOf(ComboBox1.Text);
    返回-1:表示沒有 0:第1行 1:第2行...
      

  3.   

    with adoquery1 do
    begin
    close;
    sql.Clear;
    sql.Add('select * from table where "'+combobox1.text+'">:a and "'+combobox1.text+'"=:b');
    parameters.ParamByName('a').Value:=datetimetostr(datetimepicker1.date);
    parameters.ParamByName('b').Value:=datetimetostr(datetimepicker2.Date);
    open;
    end;我也遇到这问题了 ,查询不出来数据,,哪里有问题。。??
      

  4.   

    var
      i : integer;
    begin
      i:=ComboBox1.Items.IndexOf(Trim(ComboBox1.Text));
      //显示你所选的行号
      Showmessage(inttostr(i));
    end;