What I tried to achieve is like setting ItemIndex to -1 as like in normal ComboBox, so that the selected item will be cleared.
There is no ItemIndex for DBLookupComboBox, and the Text property is read only. So how do I clear the selected item? Please help. Many thanks in advance.
PS: Closing and reopening the DBLookupComboBox->ListSource DataSet does not help.
Two ways:
1) at runtime: DbLookupComboBox.KeyValue := null;
2) at design-time: set the DbLookupComboBox.NullValueKey property to DEL (or whatever key you want to use to null the value during runtime)
You can use
DBLookupComboBox.KeyValue := -1;
DBLookupComboBox represents the value of a field of a database. So you have to clear/change the value of the field to clear/change the value of the DBLookupComboBox by code.
if first time you set dblokupcombobox KeyField in property is 'city' //example
if you want to clear selected item you can use this
procedure TFtreset.BitBtn6Click(Sender: TObject);
begin
dblookupcombobox2.KeyValue:='city';
end;