?
Solved

adding items to array list comparing with list box items in C# windows form

Posted on 2007-09-28
1
Medium Priority
?
983 Views
Last Modified: 2013-11-26
i had a arraylist i want to add items to array list only if the items are not contained in the listbox
so iam using the array list as follows
ArrayList  aL=new ArrayList ();
if(aL.Contains(.........how to check the items in listbox...)
0
Comment
Question by:kranthi4uonly
1 Comment
 
LVL 22

Accepted Solution

by:
JimBrandley earned 2000 total points
ID: 19979588
The ListBox Items property returns a collection of objects. So,
string next = string.Empty;
for each( object item in myListBox.Items)
{
   next = item as string;
   if (!al.Contains(next))
      al.Add(next);
}

Jim
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

850 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