Announcement

Collapse
No announcement yet.

Looping through nested array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looping through nested array

    Hi All,

    Quick and easy question regarding Arrays.
    I have let's say 4 sections and each section has 3 subsections.
    What i want to do is loop through sections and subsection then if the result = subsection2 which is inside section 1 for example will do some actions.

    Dim sectionsAll As Array[String]
    sectionsAll.push("subsectionOne")
    sectionsAll.push("subsectionTwo")
    sectionsAll.push("subsectionThree")
    sectionsAll.push("subsectionFour")

    Dim subsectionOne As Array[String]
    subsectionOne.push("one")
    subsectionOne.push("two")
    subsectionOne.push("three")


    Dim subsectionTwo As Array[String]
    subsectionTwo.push("one")
    subsectionTwo.push("two")
    subsectionTwo.push("three")

    Dim subsectionThree As Array[String]
    subsectionThree.push("one")
    subsectionThree.push("two")
    subsectionThree.push("three")

    Dim subsectionFour As Array[String]
    subsectionFour.push("one")
    subsectionFour.push("two")
    subsectionFour.push("three")


    your help is much appreciate it.

  • #2
    i didn't test it but i guess:

    Code:
    for Each sec In sectionsAll
    if sec="subsectionTwo" Then
    for Each secTwo In subsectionTwo
    Msgbox(secTwo)
    Next
    End if
    Next

    Comment

    Working...
    X