Solved

dbLookUpComboBox

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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