Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DBLookupComboBox - How to clear the selected item?

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.

like image 556
Kw Choy Avatar asked Jan 05 '12 10:01

Kw Choy


2 Answers

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)

like image 178
John Easley Avatar answered Oct 02 '22 04:10

John Easley


You can use

DBLookupComboBox.KeyValue := -1;
like image 38
kutsoff Avatar answered Oct 02 '22 05:10

kutsoff