troubleshooting Question

Using arrays

Avatar of Tom_Hickerson
Tom_HickersonFlag for United States of America asked on
Visual Basic.NET
7 Comments3 Solutions216 ViewsLast Modified:
If I want to have an array of strings that I can add to.  How can I do this without keeping track of every time I add a new string.  

So what I have been doing is this...
  Dim myStrings(1000) As String
  Dim myStringCount As Integer

Then while the program is doing its sorting work
   If Not myStrings.Contains(pair.Primary) Then
                myStrings(myStringCount) = pair.Primary
              myStringCount  = myStringCount + 1
    End If

Then when I display them
I do a for loop using myStringCount to display each item
     For i = 0 To myStringCount - 1

I'm sure there is a more efficient way.  How would you guys do this?
Jayadev Nair
Sr.Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros