9

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?

3 Answers 3

17

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
0
0
Dim i As Integer
Dim stringArray() as String

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

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

This is the coding for above questions. I have re do and also include the output using Visual Basic 6.0 it is pretty simple and easy to understand. However,I wanted to try for more iteration.

click here for the coding and the output

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.