Solved

dbLookUpComboBox

Posted on 1999-01-26
3
1,080 Views
Last Modified: 2012-08-13
Hi,
I have a dbLookUpComboBox and when an item has been selected I want to clear the combobox. How do I do that?
0
Comment
Question by:svenj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:Oli2
ID: 1363349
use the OnChange Event.

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

Greetings, Oli
0
 

Author Comment

by:svenj
ID: 1363350
Hi Oli2,
I have a DBLookUpComboBox and that solution dosn't work for it.

// svenj
0
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 10 total points
ID: 1363351
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.

Jay
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question