34,333
edits
Changes
→Creating a Visual Basic For Loop
...''VB Statements''...<br>
'''Next''' ''counterVariable''<br>
The easiest way to gain an understanding of For loops is to see an example. The following code excerpt declares a variable to act as the loop counter and the performs a loop 5 times, displaying the value of the counter on each loop iteration:
<pre>
Dim intCount As Integer
For intCount = 0 To 5
MessageBox.Show("Counter is currently: " + CStr(intCount))
Next intCount
</pre>