Looping through each element of an array

  • Thread starter Thread starter Conan Kelly
  • Start date Start date
C

Conan Kelly

Hello All,

Is there better code for looping through each element in an array than

For pintIndex = 0 to 7
'do stuff in pstrArrayName(pintIndex)
Next pintIndex


I was hoping for something like a For...Each statement.

For each (element) in pstrArrayName
'do stuff
Next (element)

Thanks for any help anyone can provide,

Conan Kelly
 
Conan Kelly

maybe something like:

For pintIndex = lbound(pstrArrayName) to ubound(pstrArrayName)
'do stuff in pstrArrayName(pintIndex)
Next pintIndex

assuming the number of elements varies (and that's what you are trying to
overcome)

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top