你把combobox里的内容存在一张表里,当你输完回车或者是combobox失去焦点后,就触发: query1.close; queryl.sql.clear; query1.sql.add('select * from tablename'); query1.open; while not query1.eof do begin combobox1.items.add(query1.fildbyname('combobox所代表的字段名').asstring); query1.next; end;
可以用ExpressQuantumGrid 实现你的功能很简单的
我不太清楚的意思是什么,好像上面说得好几种方案又有很大的差距。 我的理解使用session procedure TForm1.FormCreate(Sender: TObject); begin session1.SessionName:='session1'; session1.GetAliasNames(combobox1.Items); combobox1.Text:=combobox1.Items.Strings[0]; end;procedure TForm1.ComboBox1Click(Sender: TObject); begin session1.GetTableNames(combobox1.Text,'',true,true,listbox1.Items); end;procedure TForm1.ListBox1Click(Sender: TObject); begin session1.GetFieldNames(combobox1.Items.Strings[combobox1.itemindex],listbox1.items.Strings[listbox1.itemindex],listbox2.items); end;end.
query1.close; with Query1 do begin Sql.clear; Sql.add('select * from tablename'); Open; while Not (Query1.Eof) do begin combobox1.items.add(query1.fildbyname('combobox所代表的字段名').asstring); Next; end; end;
在edit的keydown中写 if ( (Key=32) or (Key=34) or (Key=38) or (Key=40) ) then begin combobox.DroppedDown := True ; Exit ; end ; if ( Key=13 ) then begin combobox.DroppedDown := false ; comboboxOnClick(Sender) ; end ; 在onclick中: if combobox.DroppedDown then exit ; /* 你的操作....*/在Onenter事件中: combobox.Items.Clear; with query1 do beign close; sql.clear; sql.add(' select * from table1'); open ; while (not eof) do begin combobox.Items.Add(FieldByName('aa').Asstring); next ; end; end;//支持鼠标和键盘的操作! ================================================================ 一颗红心向前看,为了革命两茫然,不好意思才囊尽,只能说上一点点。 ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ ★ ★ ★ ★ ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ ================================================================
query1.close;
queryl.sql.clear;
query1.sql.add('select * from tablename');
query1.open;
while not query1.eof do
begin
combobox1.items.add(query1.fildbyname('combobox所代表的字段名').asstring);
query1.next;
end;
实现你的功能很简单的
我的理解使用session
procedure TForm1.FormCreate(Sender: TObject);
begin
session1.SessionName:='session1';
session1.GetAliasNames(combobox1.Items);
combobox1.Text:=combobox1.Items.Strings[0];
end;procedure TForm1.ComboBox1Click(Sender: TObject);
begin
session1.GetTableNames(combobox1.Text,'',true,true,listbox1.Items);
end;procedure TForm1.ListBox1Click(Sender: TObject);
begin
session1.GetFieldNames(combobox1.Items.Strings[combobox1.itemindex],listbox1.items.Strings[listbox1.itemindex],listbox2.items);
end;end.
正确
combobox1.items.add(query1.fieldbyname('combobox所代表的字段名').asstring);
with Query1 do
begin
Sql.clear;
Sql.add('select * from tablename');
Open;
while Not (Query1.Eof) do
begin
combobox1.items.add(query1.fildbyname('combobox所代表的字段名').asstring);
Next;
end;
end;
if ( (Key=32) or (Key=34) or (Key=38) or (Key=40) ) then
begin
combobox.DroppedDown := True ;
Exit ;
end ;
if ( Key=13 ) then
begin
combobox.DroppedDown := false ;
comboboxOnClick(Sender) ;
end ;
在onclick中:
if combobox.DroppedDown then exit ;
/*
你的操作....*/在Onenter事件中:
combobox.Items.Clear;
with query1 do
beign
close;
sql.clear;
sql.add(' select * from table1');
open ;
while (not eof) do
begin
combobox.Items.Add(FieldByName('aa').Asstring);
next ;
end;
end;//支持鼠标和键盘的操作!
================================================================
一颗红心向前看,为了革命两茫然,不好意思才囊尽,只能说上一点点。
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
★ ★
★ ★
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
================================================================