• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1094
  • Last Modified:


I have a dbLookUpComboBox and when an item has been selected I want to clear the combobox. How do I do that?
1 Solution
use the OnChange Event.

procedure dbComboBox.Change ( Sender: TObject );
var x: Integer;
 if dbComboBox.ItemIndex <> -1 then

Greetings, Oli
svenjAuthor Commented:
Hi Oli2,
I have a DBLookUpComboBox and that solution dosn't work for it.

// svenj
I don't think you can 'remove' teh items because it's a lookup combobox.  Teh combobox is always connected to teh table - thus there will ALWAYS be values.  There are two options;

1) remove the dataset/table property from the control.  Not to good, since the control would be blank and probably inactive.

2)  Instead of using a dbLookup, us a Tquery or a FOR loop to fill the values of a regular combobox, then use teh code above.

Logic (not code)

1) Execute Query to add for unquie values to combobox or perform For loop on lookup table to add values to combobox
2) Save the vales to a TStringList
3) Add teh values from teh StringList to the control.  You can add and remove some or all of the values as you see fit, e.g., when teh user makes a selection.

Any questions, please ask.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now