First occurence in For Each statement

I've got a For Each statement written in visual studio using vb.  It takes a comma separated statement and runs something on each item separated by the commas.  I need to do something special with the first item.  How could I do this?
schwientekdIT DirectorAsked:
Who is Participating?
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.

you could use a boolean statement.

Dim SkipSpecial As Boolean

For Each .. ..
    If SkipSpecial = False Then
        'it is the first time here, run your special code
        SkipSpecial = True
        ' .. every other time, this code will run
    End If

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
Steve KrileCommented:
Another way to do this would be to use a String Array.  Something like this:

dim commastring as String = "thingone, thingtwo, thingthre, blaj"
dim StrArr() as String
StrArr = Split(commstring,",")    <---this creates a String Array using the comma in your original string to as a separator

Now, you can do whatever you'd like to the first thing by refering to it directly - outside of the context of a loop.

StrArr(0) (which in the example I've shown here would be equal to "thingone"

And to loop through your string array you could do:

dim i as Integer = 0
for i = 0 to ubound(StrArr)

schwientekdIT DirectorAuthor Commented:
Worked perfect.  Thanks for the quick response.
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 Classic

From novice to tech pro — start learning today.