Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Cycle through an array


Dim i As Long
For i = Lbound (MyArray) To Ubound (MyArray)
    'do something with MyArray(i)
Next i

'if you know the upper/lower limits of the array, just use them
Dim MyArray(100)    'default lower limit is zero in VB
For i = 0 To 100
    'do something to MyArray(i)
Next i