Q: 如何清除 DBLookupComboBox 內容?
A: 你可以在 OnKeyDown 事件中處理, 假設要讓 user 按 Delete 鍵時清除:
If you're connected to a dataset then clear the datafield in the db:
procedure TForm1.DBLookupComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_DELETE then
begin
with Sender as TDBLookupComboBox do
begin
if not(DataSource.DataSet.State in dsEditModes) then
DataSource.DataSet.Edit;
DataSource.DataSet.FieldByName(DataField).Clear;
end;
end;
end;
               (
geocities.com/huanlin_tsai)