Solved

Searching Combobox to see if string exists

Posted on 1997-09-26
2
140 Views
Last Modified: 2012-05-04
I have a dbcombobox with a items list of authors. If the text the user enters is not an author already in the combobox list I want to be able to add it to the list (without getting multiple entries for the same author).
0
Comment
Question by:JohnE
2 Comments
 
LVL 1

Expert Comment

by:sassas081597
ID: 1346335
Hi!
Pls, Say what you really need:
1) The procedure which compares New Author and all other Autors before Post an Author or
2) the same but while the user types smth in the box?
0
 
LVL 4

Accepted Solution

by:
erajoj earned 100 total points
ID: 1346336
Easiest way (case insensitive):

AlreadyThere := (ComboBox.Items.IndexOf(NewEntry)<>-1);
if not AlreadyThere then begin
  ComboBox.Items.Add(NewEntry)
end;

/// John

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

929 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

10 Experts available now in Live!

Get 1:1 Help Now