• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

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.
 
0
doanket
Asked:
doanket
1 Solution
 
bluebetaCommented:
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
 
doanketAuthor Commented:
Thank Bluebeta but. I wite code in VB 6.0
This Tree is Values of 1Grid and I must read.



0
 
jkaiosCommented:
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
 
mateenmalikCommented:
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now