Solved

dbLookUpComboBox

Posted on 1999-01-26
3
1,073 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now