how to check an arralist with individual Alphanumeric entries.

I want to search an arraylist of entries and if an entry is is there do not duplicate the entry and jsut move on. If the entry is new I want to add it to the arraylist.

If _ExcelGageID.startswith("L")  then
_ExcelArraylist.add(wirelessArray(1)
end if

Open in new window

cmdolcetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
What kind of Object are stored in the ArrayList?
If not basic types such as integers, double, ... what is the object structure and what fields will determine equality?
0
Fernando SotoRetiredCommented:
Hi cmdolcet;

If using a basic data type such as integer then doing the following should do what you need.
Dim al As New ArrayList
'' ...
Dim itemToInset As Integer = 4

If Not al.Contains(itemToInset) Then
    al.Add(itemToInset)
End If

Open in new window

0
cmdolcetAuthor Commented:
Sorry just saw that. I am looking to add an alphanumeric number like "L12345" to the arraylist.
0
Fernando SotoRetiredCommented:
Then this should work. Be aware that the alpha's must have the same case as what you are trying to insert otherwise it will not compare correctly.
Dim al As New ArrayList
'' ...
Dim itemToInset As String = "L4"

If Not al.Contains(itemToInset) Then
    al.Add(itemToInset)
End If

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.