11

Here's my code so far:

Dim i As Integer
Dim stringArray() as String

stringArray = split("Hello|there", "|")

For i = 0 To stringArray.Length()
   ' Logic goes here
Next

VB6 doesn't seem to like me using stringAray.Length() and gives me a compile error message like Invalid Qualifier, but what's the right way to iterate through each element of a string array?

2 Answers 2

19

ubound() returns the upper bounds;

Dim i As Long
Dim stringArray(1) as String

stringArray(0) = "hello"
stringArray(1) = "world"

For i = 0 To ubound(stringArray)
   msgbox(stringArray(i))
Next
Sign up to request clarification or add additional context in comments.

Comments

0
Dim i As Integer
Dim stringArray() as String

stringArray = split("Hello|there", "|")

For i = 0 To ubound(stringArray)
   ' Logic goes here
Next

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.