Solved

TListBox contains no duplicates

Posted on 1998-10-08
1
250 Views
Last Modified: 2010-04-06
How can I ensure that when I add an Item to a TListBox and/or a TComboBox (e.g. ListBox1.Items.Add('add this')) that the new string is not already in the list?  I am trying to keep duplicates OUT of these lists/components.
0
Comment
Question by:Softtech
1 Comment
 
LVL 7

Accepted Solution

by:
BlackMan earned 70 total points
ID: 1342301
You can do something like this

If ListBox1.Items.IndexOf(MyStr) = -1 Then // MyStr not found
  ListBox1.Items.Add(MyStr);

The same goes for ComboBox..
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

24 Experts available now in Live!

Get 1:1 Help Now