title: VB: Declaring variables in For loop
body: <p>I have been trying to declare variables inside a For loop for quite some time now, and I just haven't been able to find a way.<br>
  I'm attempting to create a new image (tile) for every time a certain number is encountered in a two-dimensioned array (Measuring 32x16). I may need to add in that I am using Visual Basic 6.  </p>
  
  <p>Currently I'm using the following code:</p>
  
  <pre><code>Option Explicit
  Dim wCount As Integer
  Dim hCount As Integer
  Dim arrTiles(31, 15) As Integer
  
  
  Private Sub Form_Load()
      For wCount = 0 To 31 Step 1
          For hCount = 0 To 15 Step 1
              ' -Declare variables
              ' -I.E. Dim NAME As Image
          Next
      Next
  End Sub
  </code></pre>
  
  <p>However, the above code (Using Dim tile1 As Image) gives me an error whenever trying to access one of the properties of the newly added image (Such as tile1.Width).  </p>
  
  <p>Is there any way to declare a variable this way at run-time?</p>
  
  <p>Sincerely<br>
  - Birjolaxew</p>