title: vb.net for each loop counter
body: <p>I am trying to make a program to organize folders full of random stuff. I want it to put each file type into a folder that describes what it is in it. I have arrays of file types inside another array so it can loop through. </p>
  
  <p>It can move the file types specified in the array fine, but when I tried to make it put each type into a seperate folder, it says that the array index is out of bounds.</p>
  
  <p>It works fine if you replace the index of Names to a number, but i can't get it to change it automatically.</p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>Dim Extensions As Array = {Audio, Video, Image, Document, PlainText, Batch, Powershell, VB, DiskImage, Compressed, Excutable, Model, Code, Web, Registry}
  Dim Names As String() = {"Audio", "Videos", "Pictures", "Documents", "Text Documents", "Batch", "Powershell", "Visual Basic", "DiskImages", "Compressed Files", "Excutables", "3d Models", "Code", "Web", "Registry"}
  
      Dim number As Integer = 0
      For Each type As String() In Extensions
          number += 1
          path = path + Names(number)
  
          For Each extension As String In type
              Label2.Text = extension
              CopyMove(FolderBrowserDialog2.SelectedPath, path, extension, s)
          Next
  
      Next
  </code></pre>