# For..Next?

I have 2 array
- Array1:   "1,2"
- Array2:   "3,4,5"
1
3
4
5
2
3
4
5
I want use 2 for ..next
I Write code: For i= 1 To Array1
For j = i + 1 To Array2- j
Msgbox i & "_" & j
Next
Next
But not Yet
Help Me to Repair Code
Thank You.

###### 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.

Commented:
Try this :

<%
array1 = array(1, 2)
array2 = array(3, 4, 5)

for i=0 to ubound(array1)
response.Write array1(i) & "<br/>"
for j=0 to ubound(array2)
response.Write "&nbsp;" & array2(j) & "<br/>"
next
next
%>

hope this help.
0
Author Commented:
Thank Bluebeta but. I wite code in VB 6.0
This Tree is Values of 1Grid and I must read.

0
IT DirectorCommented:
Try this. Let just say that you have a 3-dimensional array call "myArray" where the first dimension contains
five (5) elements and the second dimension contains ten (10) elements, and the third dimension
contains twenty (20) elements. But In your case you'll have to comment out the third nested loop - "For kk ..."

For ii = 1 To 5                '// Dimension1, 5 elements
For jj = 1 To 10            '// Dimension2, 10 elements
For kk = 1 To 20        '// Dimension3, 20 elements
If myArray(ii, jj, kk) > 0 Then
Debug.Print myArray(ii, jj, kk)
End If
Next kk
Next jj
Next ii
0
Commented:
I think this is the VB Code you are looking for.
All The Bests.

Dim i As Integer
Dim j As Integer
'---Define The Array's----
Dim array1(1) As String
Dim array2(2) As String

'---Fill Data In The Array's, I Have Used 2 Methods To Do That---
array1(0) = "1"
array1(1) = "2"

i = 0
While i < 3
array2(i) = i + 3
i = i + 1
Wend

'----Show The Contents Of The Array's----
For i = 0 To UBound(array1)
For j = 0 To UBound(array2)
MsgBox (array1(i) & "_" & array2(j))
MsgBox (i & "_" & j)
Next
Next
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

###### 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
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.