问题描述
我想要实现的目标就像将ItemIndex设置为-1一样,就像在普通ComboBox中一样,以便清除所选的项目。
What I tried to achieve is like setting ItemIndex to -1 as like in normal ComboBox, so that the selected item will be cleared.
DBLookupComboBox没有ItemIndex,并且Text属性是只读的。那么,如何清除所选项目?请帮忙。
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:关闭并重新打开DBLookupComboBox-> ListSource数据集无济于事。
PS: Closing and reopening the DBLookupComboBox->ListSource DataSet does not help.
推荐答案
两种方式:
1)在运行时:DbLookupComboBox。 KeyValue:= null;
1) at runtime: DbLookupComboBox.KeyValue := null;
2):在设计时:将DbLookupComboBox.NullValueKey属性设置为DEL(或在运行时将空值使用的任何键)
2) at design-time: set the DbLookupComboBox.NullValueKey property to DEL (or whatever key you want to use to null the value during runtime)
这篇关于DBLookupComboBox-如何清除所选项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!