问题如题:
愿准备当用户按下回车键的时候,检索数据库内的表字段并添加到combobox的项目里,然后显示检索到的第一个数据
我的代码如下:
procedure TForm1.ComboBox3KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   if Key=13 then
   if  Trim(ComboBox3.text)='' then
    begin
     Application.MessageBox('请输入疾病名称或拼音码','提示!',0+64);
     ComboBox3.SetFocus;
    end
   else
   begin
    with DM.icd10 do
    begin
      Close;
      sql.clear;
      sql.Add('select disease_name FROM disease where disease_pym like :a or disease_name like :a ');
      parameters.parambyname('a').value:='%'+AnsiUpperCase(trim(ComboBox3.text))+'%';
      Open;
    end;
    ComboBox3.Items.Clear;
    while  NOT DM.icd10.Eof do
     Begin
      ComboBox3.Items.add(DM.icd10.Fields[0].VALUE);
      Dm.icd10.Next;
     END;
   end;
    SendMessage(combobox3.Handle,CB_SHOWDROPDOWN,1,1);
   ComboBox3.ItemIndex:=0;//问题就在这里
end;
问题就出在这句ComboBox3.ItemIndex:=0,如果我一加这句combobox3的文本框内就只能输入一个字母,请问这是怎么回事?是我选择的事件错了吗?还是我设置的问题?