Solved

dbLookUpComboBox

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree compare node issue 14 105
Delphi XE10 Round Image 2 78
Print Graphic and Text to Epson TM-T88v 12 182
Delphi inherited method 6 63
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

11 Experts available now in Live!

Get 1:1 Help Now